Merge pull request #52 from dotnet-architecture/dev
eShopOnContainers fork
| @ -111,6 +111,7 @@ services: | |||||||
|       - OrchestratorType=${ORCHESTRATOR_TYPE} |       - OrchestratorType=${ORCHESTRATOR_TYPE} | ||||||
|       - UseLoadTest=${USE_LOADTEST:-False} |       - UseLoadTest=${USE_LOADTEST:-False} | ||||||
|       - Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ=Verbose |       - Serilog__MinimumLevel__Override__Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ=Verbose | ||||||
|  |       - Serilog__MinimumLevel__Override__Ordering.API=Verbose | ||||||
|     ports: |     ports: | ||||||
|       - "5102:80"   # Important: In a production environment your should remove the external port (5102) kept here for microservice debugging purposes.  |       - "5102:80"   # Important: In a production environment your should remove the external port (5102) kept here for microservice debugging purposes.  | ||||||
|                     # The API Gateway redirects and access through the internal port (80). |                     # The API Gateway redirects and access through the internal port (80). | ||||||
|  | |||||||
							
								
								
									
										
											BIN
										
									
								
								docs/MicrosoftAzure_StartGuide_Developers-old.pdf
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @ -29,7 +29,7 @@ app:                                                  # app global settings | |||||||
|       catalog: catalog                                  # service name for catalog api |       catalog: catalog                                  # service name for catalog api | ||||||
|       ordering: ordering                                # service name for ordering api |       ordering: ordering                                # service name for ordering api | ||||||
|       orderingbackgroundtasks: orderingbackgroundtasks  # service name for orderingbackgroundtasks |       orderingbackgroundtasks: orderingbackgroundtasks  # service name for orderingbackgroundtasks | ||||||
|       orderingsignalrhub: ordering-signalrhub            # service name for orderingsignalrhub |       orderingsignalrhub: ordering-signalrhub           # service name for orderingsignalrhub | ||||||
|       identity: identity                                # service name for identity api |       identity: identity                                # service name for identity api | ||||||
|       mvc: webmvc                                       # service name for web mvc |       mvc: webmvc                                       # service name for web mvc | ||||||
|       spa: webspa                                       # service name for web spa |       spa: webspa                                       # service name for web spa | ||||||
|  | |||||||
| @ -15,5 +15,5 @@ data: | |||||||
|   urls__IdentityUrl: http://{{ $identity }} |   urls__IdentityUrl: http://{{ $identity }} | ||||||
|   basket__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   basket__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
| @ -16,5 +16,5 @@ data: | |||||||
|   catalog__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ |   catalog__PicBaseUrl: http://{{ $webshoppingapigw }}/api/v1/c/catalog/items/[0]/pic/ | ||||||
|   catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}" |   catalog__AzureStorageEnabled: "{{ .Values.inf.misc.useAzureStorage }}" | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
| @ -67,7 +67,7 @@ $charts = ("eshop-common", "apigwmm", "apigwms", "apigwwm", "apigwws", "basket-a | |||||||
| if ($deployInfrastructure) { | if ($deployInfrastructure) { | ||||||
|     foreach ($infra in $infras) { |     foreach ($infra in $infras) { | ||||||
|         Write-Host "Installing infrastructure: $infra" -ForegroundColor Green |         Write-Host "Installing infrastructure: $infra" -ForegroundColor Green | ||||||
|         helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --name="$appName-$infra" $infra      |         helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" --name="$appName-$infra" $infra      | ||||||
|     } |     } | ||||||
| } | } | ||||||
| else { | else { | ||||||
| @ -78,11 +78,11 @@ if ($deployCharts) { | |||||||
|     foreach ($chart in $charts) { |     foreach ($chart in $charts) { | ||||||
|         Write-Host "Installing: $chart" -ForegroundColor Green |         Write-Host "Installing: $chart" -ForegroundColor Green | ||||||
|         if ($useCustomRegistry) { |         if ($useCustomRegistry) { | ||||||
|             helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart  |             helm install --set inf.registry.server=$registry --set inf.registry.login=$dockerUser --set inf.registry.pwd=$dockerPassword --set inf.registry.secretName=eshop-docker-scret --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns --set "ingress.hosts={$dns}" --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart  | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             if ($chart -ne "eshop-common")  {       # eshop-common is ignored when no secret must be deployed |             if ($chart -ne "eshop-common")  {       # eshop-common is ignored when no secret must be deployed | ||||||
|                 helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns  --set ingress.hosts={$dns} --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart  |                 helm install --values app.yaml --values inf.yaml --values $ingressValuesFile --set app.name=$appName --set inf.k8s.dns=$dns  --set "ingress.hosts={$dns}" --set image.tag=$imageTag --set image.pullPolicy=Always --name="$appName-$chart" $chart  | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -24,7 +24,7 @@ metadata: | |||||||
| data: | data: | ||||||
|   identity__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.identity.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; |   identity__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.identity.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; | ||||||
|   identity__keystore: {{ .Values.inf.redis.keystore.constr }} |   identity__keystore: {{ .Values.inf.redis.keystore.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   mvc_e: http://{{ $mvc_url }} |   mvc_e: http://{{ $mvc_url }} | ||||||
|   spa_e: http://{{ $spa_url }} |   spa_e: http://{{ $spa_url }} | ||||||
|   locations_e: http://{{ $locations_url }} |   locations_e: http://{{ $locations_url }} | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| # This heml values file defines all infrastructure used by eShopOnContainers. | # This helm values file defines all infrastructure used by eShopOnContainers. | ||||||
| # It is used on all charts, so ** MUST BE INCLUDED ** on every deployment | # It is used on all charts, so ** MUST BE INCLUDED ** on every deployment | ||||||
| 
 | 
 | ||||||
| inf: | inf: | ||||||
| @ -15,11 +15,11 @@ inf: | |||||||
|     identity: |     identity: | ||||||
|       db: IdentityDb        # Ordering API SQL db name |       db: IdentityDb        # Ordering API SQL db name | ||||||
|     marketing: |     marketing: | ||||||
|       db: MarketingDb        # Marketing API SQL db name |       db: MarketingDb       # Marketing API SQL db name | ||||||
|     webhooks: |     webhooks: | ||||||
|       db: WebhooksDb            # Webhooks DB |       db: WebhooksDb        # Webhooks DB | ||||||
|   mongo: |   mongo: | ||||||
| #    host: my-nosql-data     # Uncomment to use specify custom mongo host. By default nosql-data is used | #    host: my-nosql-data    # Uncomment to use specify custom mongo host. By default nosql-data is used | ||||||
|     locations: |     locations: | ||||||
|       database: LocationsDb |       database: LocationsDb | ||||||
|     marketing: |     marketing: | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ metadata: | |||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   internalurls__IdentityUrl: http://{{ .Values.app.svc.identity }} |   internalurls__IdentityUrl: http://{{ .Values.app.svc.identity }} | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ metadata: | |||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   internalurls__IdentityUrl: http://{{ .Values.app.svc.identity }} |   internalurls__IdentityUrl: http://{{ .Values.app.svc.identity }} | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ metadata: | |||||||
|     release: {{ .Release.Name }} |     release: {{ .Release.Name }} | ||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   mobileshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }} |   mobileshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }} | ||||||
|   internalurls__basket: http://{{ .Values.app.svc.basket }} |   internalurls__basket: http://{{ .Values.app.svc.basket }} | ||||||
|  | |||||||
| @ -16,5 +16,5 @@ data: | |||||||
|   ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   urls__IdentityUrl: http://{{ $identity }} |   urls__IdentityUrl: http://{{ $identity }} | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
| @ -15,7 +15,7 @@ data: | |||||||
|   ordering__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.ordering.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; |   ordering__ConnectionString: Server={{ $sqlsrv }};Initial Catalog={{ .Values.inf.sql.ordering.db }};User Id={{ .Values.inf.sql.common.user }};Password={{ .Values.inf.sql.common.pwd }}; | ||||||
|   ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   ordering__EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
|   graceperiodmanager__CheckUpdateTime: "{{ .Values.cfg.checkUpdateTime }}" |   graceperiodmanager__CheckUpdateTime: "{{ .Values.cfg.checkUpdateTime }}" | ||||||
|   graceperiodmanager__GracePeriodTime: "{{ .Values.cfg.gracePeriodTime }}" |   graceperiodmanager__GracePeriodTime: "{{ .Values.cfg.gracePeriodTime }}" | ||||||
| @ -12,7 +12,7 @@ metadata: | |||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
|   signalr__StoreConnectionString: {{ .Values.inf.redis.keystore.constr }} |   signalr__StoreConnectionString: {{ .Values.inf.redis.keystore.constr }} | ||||||
|   urls__IdentityUrl: http://{{ $identity }} |   urls__IdentityUrl: http://{{ $identity }} | ||||||
| @ -11,5 +11,5 @@ metadata: | |||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
| @ -16,5 +16,5 @@ data: | |||||||
|   urls__IdentityUrl: http://{{ $identity }} |   urls__IdentityUrl: http://{{ $identity }} | ||||||
|   urls__IdentityUrlExternal: http://{{ $identity }} |   urls__IdentityUrlExternal: http://{{ $identity }} | ||||||
|   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} |   all__EventBusConnection: {{ .Values.inf.eventbus.constr }} | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
| @ -14,7 +14,7 @@ metadata: | |||||||
|     release: {{ .Release.Name }} |     release: {{ .Release.Name }} | ||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   webmvc__keystore: {{ .Values.inf.redis.keystore.constr }} |   webmvc__keystore: {{ .Values.inf.redis.keystore.constr }} | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ metadata: | |||||||
|     release: {{ .Release.Name }} |     release: {{ .Release.Name }} | ||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   webshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }} |   webshoppingagg__keystore: {{ .Values.inf.redis.keystore.constr }} | ||||||
|   internalurls__basket: http://{{ .Values.app.svc.basket }} |   internalurls__basket: http://{{ .Values.app.svc.basket }} | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ metadata: | |||||||
|     release: {{ .Release.Name }} |     release: {{ .Release.Name }} | ||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   webspa__keystore: {{ .Values.inf.redis.keystore.constr }} |   webspa__keystore: {{ .Values.inf.redis.keystore.constr }} | ||||||
|   internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }} |   internalurls__apigwws: http://{{ .Values.app.svc.webshoppingapigw }} | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ metadata: | |||||||
|     release: {{ .Release.Name }} |     release: {{ .Release.Name }} | ||||||
|     heritage: {{ .Release.Service }} |     heritage: {{ .Release.Service }} | ||||||
| data: | data: | ||||||
|   all__InstrumentationKey: {{ .Values.inf.appinsights.key }} |   all__InstrumentationKey: "{{ .Values.inf.appinsights.key }}" | ||||||
|   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" |   all__UseAzureServiceBus: "{{ .Values.inf.eventbus.useAzure }}" | ||||||
|   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" |   all_EnableLoadTest: "{{ .Values.inf.misc.useLoadTest }}" | ||||||
|   webstatus__keystore: {{ .Values.inf.redis.keystore.constr }} |   webstatus__keystore: {{ .Values.inf.redis.keystore.constr }} | ||||||
|  | |||||||
| @ -36,15 +36,9 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // Retrieve the current basket |             // Retrieve the current basket | ||||||
|             var currentBasket = await _basket.GetByIdAsync(data.BuyerId); |             var basket = await _basket.GetByIdAsync(data.BuyerId) ?? new BasketData(data.BuyerId); | ||||||
| 
 |  | ||||||
|             if (currentBasket == null) |  | ||||||
|             { |  | ||||||
|                 currentBasket = new BasketData(data.BuyerId); |  | ||||||
|             } |  | ||||||
| 
 | 
 | ||||||
|             var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId)); |             var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId)); | ||||||
|             var newBasket = new BasketData(data.BuyerId); |  | ||||||
| 
 | 
 | ||||||
|             foreach (var bitem in data.Items) |             foreach (var bitem in data.Items) | ||||||
|             { |             { | ||||||
| @ -54,7 +48,7 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers | |||||||
|                     return BadRequest($"Basket refers to a non-existing catalog item ({bitem.ProductId})"); |                     return BadRequest($"Basket refers to a non-existing catalog item ({bitem.ProductId})"); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 newBasket.Items.Add(new BasketDataItem() |                 basket.Items.Add(new BasketDataItem() | ||||||
|                 { |                 { | ||||||
|                     Id = bitem.Id, |                     Id = bitem.Id, | ||||||
|                     ProductId = catalogItem.Id.ToString(), |                     ProductId = catalogItem.Id.ToString(), | ||||||
| @ -65,9 +59,9 @@ namespace Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator.Controllers | |||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             await _basket.UpdateAsync(newBasket); |             await _basket.UpdateAsync(basket); | ||||||
| 
 | 
 | ||||||
|             return newBasket; |             return basket; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         [HttpPut] |         [HttpPut] | ||||||
|  | |||||||
| @ -13,20 +13,21 @@ | |||||||
|             public void Apply(Operation operation, OperationFilterContext context) |             public void Apply(Operation operation, OperationFilterContext context) | ||||||
|             { |             { | ||||||
|                 // Check for authorize attribute |                 // Check for authorize attribute | ||||||
|                 var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |                 var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                    context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                    context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|                 if (hasAuthorize) |                 if (!hasAuthorize) return; | ||||||
|                 { |  | ||||||
|                     operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |  | ||||||
|                     operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 | 
 | ||||||
|                     operation.Security = new List<IDictionary<string, IEnumerable<string>>>(); |                 operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|                     operation.Security.Add(new Dictionary<string, IEnumerable<string>> |                 operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |                 operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|                 { |                 { | ||||||
|                     { "oauth2", new [] { "Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator" } } |                     new Dictionary<string, IEnumerable<string>> | ||||||
|                 }); |                     { | ||||||
|                 } |                         { "oauth2", new [] { "Microsoft.eShopOnContainers.Mobile.Shopping.HttpAggregator" } } | ||||||
|  |                     } | ||||||
|  |                 }; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -36,14 +36,9 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | |||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             // Retrieve the current basket |             // Retrieve the current basket | ||||||
|             var currentBasket = await _basket.GetByIdAsync(data.BuyerId); |             var basket = await _basket.GetByIdAsync(data.BuyerId) ?? new BasketData(data.BuyerId); | ||||||
|             if (currentBasket == null) |  | ||||||
|             { |  | ||||||
|                 currentBasket = new BasketData(data.BuyerId); |  | ||||||
|             } |  | ||||||
| 
 | 
 | ||||||
|             var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId)); |             var catalogItems = await _catalog.GetCatalogItemsAsync(data.Items.Select(x => x.ProductId)); | ||||||
|             var newBasket = new BasketData(data.BuyerId); |  | ||||||
| 
 | 
 | ||||||
|             foreach (var bitem in data.Items) |             foreach (var bitem in data.Items) | ||||||
|             { |             { | ||||||
| @ -53,7 +48,7 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | |||||||
|                     return BadRequest($"Basket refers to a non-existing catalog item ({bitem.ProductId})"); |                     return BadRequest($"Basket refers to a non-existing catalog item ({bitem.ProductId})"); | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 newBasket.Items.Add(new BasketDataItem() |                 basket.Items.Add(new BasketDataItem() | ||||||
|                 { |                 { | ||||||
|                     Id = bitem.Id, |                     Id = bitem.Id, | ||||||
|                     ProductId = catalogItem.Id.ToString(), |                     ProductId = catalogItem.Id.ToString(), | ||||||
| @ -64,9 +59,9 @@ namespace Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator.Controllers | |||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             await _basket.UpdateAsync(newBasket); |             await _basket.UpdateAsync(basket); | ||||||
| 
 | 
 | ||||||
|             return newBasket; |             return basket; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         [HttpPut] |         [HttpPut] | ||||||
|  | |||||||
| @ -13,20 +13,21 @@ | |||||||
|             public void Apply(Operation operation, OperationFilterContext context) |             public void Apply(Operation operation, OperationFilterContext context) | ||||||
|             { |             { | ||||||
|                 // Check for authorize attribute |                 // Check for authorize attribute | ||||||
|                 var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |                 var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                    context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                    context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|                 if (hasAuthorize) |                 if (!hasAuthorize) return; | ||||||
|                 { |  | ||||||
|                     operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |  | ||||||
|                     operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 | 
 | ||||||
|                     operation.Security = new List<IDictionary<string, IEnumerable<string>>>(); |                 operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|                     operation.Security.Add(new Dictionary<string, IEnumerable<string>> |                 operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |                 operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|                 { |                 { | ||||||
|                     { "oauth2", new [] { "Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator" } } |                     new Dictionary<string, IEnumerable<string>> | ||||||
|                 }); |                     { | ||||||
|                 } |                         { "oauth2", new [] { "Microsoft.eShopOnContainers.Web.Shopping.HttpAggregator" } } | ||||||
|  |                     } | ||||||
|  |                 }; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -6,7 +6,6 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; | |||||||
| using Microsoft.eShopOnContainers.Services.Basket.API.Model; | using Microsoft.eShopOnContainers.Services.Basket.API.Model; | ||||||
| using Microsoft.eShopOnContainers.Services.Basket.API.Services; | using Microsoft.eShopOnContainers.Services.Basket.API.Services; | ||||||
| using Microsoft.Extensions.Logging; | using Microsoft.Extensions.Logging; | ||||||
| using Serilog.Context; |  | ||||||
| using System; | using System; | ||||||
| using System.Net; | using System.Net; | ||||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||||
|  | |||||||
| @ -11,22 +11,21 @@ namespace Basket.API.Infrastructure.Filters | |||||||
|         public void Apply(Operation operation, OperationFilterContext context) |         public void Apply(Operation operation, OperationFilterContext context) | ||||||
|         { |         { | ||||||
|             // Check for authorize attribute |             // Check for authorize attribute | ||||||
|             var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |             var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|             if (hasAuthorize) |             if (!hasAuthorize) return; | ||||||
|  | 
 | ||||||
|  |             operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|  |             operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |             operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|             { |             { | ||||||
|                 operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |                 new Dictionary<string, IEnumerable<string>> | ||||||
|                 operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 |  | ||||||
|                 operation.Security = new List<IDictionary<string, IEnumerable<string>>> |  | ||||||
|                 { |                 { | ||||||
|                     new Dictionary<string, IEnumerable<string>> |                     { "oauth2", new [] { "basketapi" } } | ||||||
|                     { |                 } | ||||||
|                         { "oauth2", new [] { "basketapi" } } |             }; | ||||||
|                     } |  | ||||||
|                 }; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -1,11 +1,12 @@ | |||||||
| using Microsoft.Extensions.Logging; | using Microsoft.eShopOnContainers.Services.Basket.API.Model; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
| using Newtonsoft.Json; | using Newtonsoft.Json; | ||||||
| using StackExchange.Redis; | using StackExchange.Redis; | ||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.Linq; | using System.Linq; | ||||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||||
| 
 | 
 | ||||||
| namespace Microsoft.eShopOnContainers.Services.Basket.API.Model | namespace Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories | ||||||
| { | { | ||||||
|     public class RedisBasketRepository : IBasketRepository |     public class RedisBasketRepository : IBasketRepository | ||||||
|     { |     { | ||||||
| @ -19,6 +19,7 @@ using Microsoft.eShopOnContainers.BuildingBlocks.EventBus; | |||||||
| using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; | using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Abstractions; | ||||||
| using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; | using Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ; | ||||||
| using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; | using Microsoft.eShopOnContainers.BuildingBlocks.EventBusServiceBus; | ||||||
|  | using Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories; | ||||||
| using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.EventHandling; | using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.EventHandling; | ||||||
| using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events; | using Microsoft.eShopOnContainers.Services.Basket.API.IntegrationEvents.Events; | ||||||
| using Microsoft.eShopOnContainers.Services.Basket.API.Model; | using Microsoft.eShopOnContainers.Services.Basket.API.Model; | ||||||
|  | |||||||
| @ -1,14 +1,10 @@ | |||||||
| using Basket.FunctionalTests.Base; | using Basket.FunctionalTests.Base; | ||||||
| using Microsoft.eShopOnContainers.Services.Basket.API; | using Microsoft.eShopOnContainers.Services.Basket.API.Infrastructure.Repositories; | ||||||
| using Microsoft.eShopOnContainers.Services.Basket.API.Model; | using Microsoft.eShopOnContainers.Services.Basket.API.Model; | ||||||
| using Microsoft.Extensions.DependencyInjection; | using Microsoft.Extensions.DependencyInjection; | ||||||
| using Microsoft.Extensions.Logging; | using Microsoft.Extensions.Logging; | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using Moq; |  | ||||||
| using StackExchange.Redis; | using StackExchange.Redis; | ||||||
| using System; |  | ||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.Text; |  | ||||||
| using System.Threading.Tasks; | using System.Threading.Tasks; | ||||||
| using Xunit; | using Xunit; | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -12,20 +12,21 @@ namespace Microsoft.eShopOnContainers.Services.Locations.API.Infrastructure.Filt | |||||||
|         public void Apply(Operation operation, OperationFilterContext context) |         public void Apply(Operation operation, OperationFilterContext context) | ||||||
|         { |         { | ||||||
|             // Check for authorize attribute |             // Check for authorize attribute | ||||||
|             var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |             var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|             if (hasAuthorize) |             if (!hasAuthorize) return; | ||||||
|  | 
 | ||||||
|  |             operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|  |             operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |             operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|             { |             { | ||||||
|                 operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |                 new Dictionary<string, IEnumerable<string>> | ||||||
|                 operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 |  | ||||||
|                 operation.Security = new List<IDictionary<string, IEnumerable<string>>>(); |  | ||||||
|                 operation.Security.Add(new Dictionary<string, IEnumerable<string>> |  | ||||||
|                 { |                 { | ||||||
|                     { "oauth2", new [] { "locationsapi" } } |                     { "oauth2", new [] { "locationsapi" } } | ||||||
|                 }); |                 } | ||||||
|             } |             }; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -11,22 +11,21 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Infrastructure.Filt | |||||||
|         public void Apply(Operation operation, OperationFilterContext context) |         public void Apply(Operation operation, OperationFilterContext context) | ||||||
|         { |         { | ||||||
|             // Check for authorize attribute |             // Check for authorize attribute | ||||||
|             var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |             var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|             if (hasAuthorize) |             if (!hasAuthorize) return; | ||||||
|  | 
 | ||||||
|  |             operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|  |             operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |             operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|             { |             { | ||||||
|                 operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |                 new Dictionary<string, IEnumerable<string>> | ||||||
|                 operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 |  | ||||||
|                 operation.Security = new List<IDictionary<string, IEnumerable<string>>> |  | ||||||
|                 { |                 { | ||||||
|                     new Dictionary<string, IEnumerable<string>> |                     { "oauth2", new [] { "marketingapi" } } | ||||||
|                     { |                 } | ||||||
|                         { "oauth2", new [] { "marketingapi" } } |             }; | ||||||
|                     } |  | ||||||
|                 }; |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -1,17 +1,16 @@ | |||||||
| using FluentValidation; | using FluentValidation; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
| using Ordering.API.Application.Commands; | using Ordering.API.Application.Commands; | ||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Ordering.API.Application.Validations | namespace Ordering.API.Application.Validations | ||||||
| { | { | ||||||
|     public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand> |     public class CancelOrderCommandValidator : AbstractValidator<CancelOrderCommand> | ||||||
|     { |     { | ||||||
|         public CancelOrderCommandValidator() |         public CancelOrderCommandValidator(ILogger<CancelOrderCommandValidator> logger) | ||||||
|         { |         { | ||||||
|             RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); |             RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); | ||||||
|  | 
 | ||||||
|  |             logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -1,5 +1,6 @@ | |||||||
| using FluentValidation; | using FluentValidation; | ||||||
| using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
| using System; | using System; | ||||||
| using System.Collections.Generic; | using System.Collections.Generic; | ||||||
| using System.Linq; | using System.Linq; | ||||||
| @ -9,19 +10,21 @@ namespace Ordering.API.Application.Validations | |||||||
| { | { | ||||||
|     public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand> |     public class CreateOrderCommandValidator : AbstractValidator<CreateOrderCommand> | ||||||
|     { |     { | ||||||
|         public CreateOrderCommandValidator() |         public CreateOrderCommandValidator(ILogger<CreateOrderCommandValidator> logger) | ||||||
|         { |         { | ||||||
|             RuleFor(command => command.City).NotEmpty(); |             RuleFor(command => command.City).NotEmpty(); | ||||||
|             RuleFor(command => command.Street).NotEmpty(); |             RuleFor(command => command.Street).NotEmpty(); | ||||||
|             RuleFor(command => command.State).NotEmpty(); |             RuleFor(command => command.State).NotEmpty(); | ||||||
|             RuleFor(command => command.Country).NotEmpty(); |             RuleFor(command => command.Country).NotEmpty(); | ||||||
|             RuleFor(command => command.ZipCode).NotEmpty(); |             RuleFor(command => command.ZipCode).NotEmpty(); | ||||||
|             RuleFor(command => command.CardNumber).NotEmpty().Length(12, 19);  |             RuleFor(command => command.CardNumber).NotEmpty().Length(12, 19); | ||||||
|             RuleFor(command => command.CardHolderName).NotEmpty(); |             RuleFor(command => command.CardHolderName).NotEmpty(); | ||||||
|             RuleFor(command => command.CardExpiration).NotEmpty().Must(BeValidExpirationDate).WithMessage("Please specify a valid card expiration date");  |             RuleFor(command => command.CardExpiration).NotEmpty().Must(BeValidExpirationDate).WithMessage("Please specify a valid card expiration date"); | ||||||
|             RuleFor(command => command.CardSecurityNumber).NotEmpty().Length(3);  |             RuleFor(command => command.CardSecurityNumber).NotEmpty().Length(3); | ||||||
|             RuleFor(command => command.CardTypeId).NotEmpty(); |             RuleFor(command => command.CardTypeId).NotEmpty(); | ||||||
|             RuleFor(command => command.OrderItems).Must(ContainOrderItems).WithMessage("No order items found");  |             RuleFor(command => command.OrderItems).Must(ContainOrderItems).WithMessage("No order items found"); | ||||||
|  | 
 | ||||||
|  |             logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         private bool BeValidExpirationDate(DateTime dateTime) |         private bool BeValidExpirationDate(DateTime dateTime) | ||||||
| @ -34,4 +37,4 @@ namespace Ordering.API.Application.Validations | |||||||
|             return orderItems.Any(); |             return orderItems.Any(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -1,13 +1,16 @@ | |||||||
| using FluentValidation; | using FluentValidation; | ||||||
| using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | using Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
| 
 | 
 | ||||||
| namespace Ordering.API.Application.Validations | namespace Ordering.API.Application.Validations | ||||||
| { | { | ||||||
|     public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand,bool>> |     public class IdentifiedCommandValidator : AbstractValidator<IdentifiedCommand<CreateOrderCommand,bool>> | ||||||
|     { |     { | ||||||
|         public IdentifiedCommandValidator() |         public IdentifiedCommandValidator(ILogger<IdentifiedCommandValidator> logger) | ||||||
|         { |         { | ||||||
|             RuleFor(command => command.Id).NotEmpty();     |             RuleFor(command => command.Id).NotEmpty(); | ||||||
|  | 
 | ||||||
|  |             logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,17 +1,16 @@ | |||||||
| using FluentValidation; | using FluentValidation; | ||||||
|  | using Microsoft.Extensions.Logging; | ||||||
| using Ordering.API.Application.Commands; | using Ordering.API.Application.Commands; | ||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 | 
 | ||||||
| namespace Ordering.API.Application.Validations | namespace Ordering.API.Application.Validations | ||||||
| { | { | ||||||
|     public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand> |     public class ShipOrderCommandValidator : AbstractValidator<ShipOrderCommand> | ||||||
|     { |     { | ||||||
|         public ShipOrderCommandValidator() |         public ShipOrderCommandValidator(ILogger<ShipOrderCommandValidator> logger) | ||||||
|         { |         { | ||||||
|             RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); |             RuleFor(order => order.OrderNumber).NotEmpty().WithMessage("No orderId found"); | ||||||
|  | 
 | ||||||
|  |             logger.LogTrace("----- INSTANCE CREATED - {ClassName}", GetType().Name); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -13,20 +13,21 @@ namespace Ordering.API.Infrastructure.Filters | |||||||
|         public void Apply(Operation operation, OperationFilterContext context) |         public void Apply(Operation operation, OperationFilterContext context) | ||||||
|         { |         { | ||||||
|             // Check for authorize attribute |             // Check for authorize attribute | ||||||
|             var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |             var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|             if (hasAuthorize) |             if (!hasAuthorize) return; | ||||||
|  | 
 | ||||||
|  |             operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|  |             operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |             operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|             { |             { | ||||||
|                 operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |                 new Dictionary<string, IEnumerable<string>> | ||||||
|                 operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 |  | ||||||
|                 operation.Security = new List<IDictionary<string, IEnumerable<string>>>(); |  | ||||||
|                 operation.Security.Add(new Dictionary<string, IEnumerable<string>> |  | ||||||
|                 { |                 { | ||||||
|                     { "oauth2", new [] { "orderingapi" } } |                     { "oauth2", new [] { "orderingapi" } } | ||||||
|                 }); |                 } | ||||||
|             } |             }; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @ -13,20 +13,21 @@ namespace Webhooks.API.Infrastructure | |||||||
|         public void Apply(Operation operation, OperationFilterContext context) |         public void Apply(Operation operation, OperationFilterContext context) | ||||||
|         { |         { | ||||||
|             // Check for authorize attribute |             // Check for authorize attribute | ||||||
|             var hasAuthorize = context.ApiDescription.ControllerAttributes().OfType<AuthorizeAttribute>().Any() || |             var hasAuthorize = context.MethodInfo.DeclaringType.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any() || | ||||||
|                                context.ApiDescription.ActionAttributes().OfType<AuthorizeAttribute>().Any(); |                                context.MethodInfo.GetCustomAttributes(true).OfType<AuthorizeAttribute>().Any(); | ||||||
| 
 | 
 | ||||||
|             if (hasAuthorize) |             if (!hasAuthorize) return; | ||||||
|  | 
 | ||||||
|  |             operation.Responses.TryAdd("401", new Response { Description = "Unauthorized" }); | ||||||
|  |             operation.Responses.TryAdd("403", new Response { Description = "Forbidden" }); | ||||||
|  | 
 | ||||||
|  |             operation.Security = new List<IDictionary<string, IEnumerable<string>>> | ||||||
|             { |             { | ||||||
|                 operation.Responses.Add("401", new Response { Description = "Unauthorized" }); |                 new Dictionary<string, IEnumerable<string>> | ||||||
|                 operation.Responses.Add("403", new Response { Description = "Forbidden" }); |  | ||||||
| 
 |  | ||||||
|                 operation.Security = new List<IDictionary<string, IEnumerable<string>>>(); |  | ||||||
|                 operation.Security.Add(new Dictionary<string, IEnumerable<string>> |  | ||||||
|                 { |                 { | ||||||
|                     { "oauth2", new [] { "webhooksapi" } } |                     { "oauth2", new [] { "webhooksapi" } } | ||||||
|                 }); |                 } | ||||||
|             } |             }; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,302 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |  | ||||||
|   <Import Project="..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props')" /> |  | ||||||
|   <Import Project="..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props" Condition="Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" /> |  | ||||||
|   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> |  | ||||||
|   <PropertyGroup> |  | ||||||
|     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |  | ||||||
|     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |  | ||||||
|     <ProductVersion> |  | ||||||
|     </ProductVersion> |  | ||||||
|     <SchemaVersion>2.0</SchemaVersion> |  | ||||||
|     <ProjectGuid>{07B42E24-32F8-4C10-99A8-0FB5AC6BFEBB}</ProjectGuid> |  | ||||||
|     <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids> |  | ||||||
|     <OutputType>Library</OutputType> |  | ||||||
|     <AppDesignerFolder>Properties</AppDesignerFolder> |  | ||||||
|     <RootNamespace>Microsoft.eShopOnContainers.Catalog.WebForms</RootNamespace> |  | ||||||
|     <AssemblyName>Catalog.WebForms</AssemblyName> |  | ||||||
|     <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> |  | ||||||
|     <UseIISExpress>true</UseIISExpress> |  | ||||||
|     <IISExpressSSLPort /> |  | ||||||
|     <IISExpressAnonymousAuthentication /> |  | ||||||
|     <IISExpressWindowsAuthentication /> |  | ||||||
|     <IISExpressUseClassicPipelineMode /> |  | ||||||
|     <UseGlobalApplicationHostFile /> |  | ||||||
|     <NuGetPackageImportStamp> |  | ||||||
|     </NuGetPackageImportStamp> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> |  | ||||||
|     <DebugSymbols>true</DebugSymbols> |  | ||||||
|     <DebugType>full</DebugType> |  | ||||||
|     <Optimize>false</Optimize> |  | ||||||
|     <OutputPath>bin\</OutputPath> |  | ||||||
|     <DefineConstants>DEBUG;TRACE</DefineConstants> |  | ||||||
|     <ErrorReport>prompt</ErrorReport> |  | ||||||
|     <WarningLevel>4</WarningLevel> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> |  | ||||||
|     <DebugSymbols>true</DebugSymbols> |  | ||||||
|     <DebugType>pdbonly</DebugType> |  | ||||||
|     <Optimize>true</Optimize> |  | ||||||
|     <OutputPath>bin\</OutputPath> |  | ||||||
|     <DefineConstants>TRACE</DefineConstants> |  | ||||||
|     <ErrorReport>prompt</ErrorReport> |  | ||||||
|     <WarningLevel>4</WarningLevel> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Reference Include="Autofac, Version=4.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\Autofac.4.3.0\lib\net45\Autofac.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |  | ||||||
|       <HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.CSharp" /> |  | ||||||
|     <Reference Include="System.ComponentModel.DataAnnotations" /> |  | ||||||
|     <Reference Include="System" /> |  | ||||||
|     <Reference Include="System.Data" /> |  | ||||||
|     <Reference Include="System.Core" /> |  | ||||||
|     <Reference Include="System.Data.DataSetExtensions" /> |  | ||||||
|     <Reference Include="System.Web.Extensions" /> |  | ||||||
|     <Reference Include="System.Xml.Linq" /> |  | ||||||
|     <Reference Include="System.Drawing" /> |  | ||||||
|     <Reference Include="System.Web" /> |  | ||||||
|     <Reference Include="System.Xml" /> |  | ||||||
|     <Reference Include="System.Configuration" /> |  | ||||||
|     <Reference Include="System.Web.Services" /> |  | ||||||
|     <Reference Include="System.EnterpriseServices" /> |  | ||||||
|     <Reference Include="System.Web.DynamicData" /> |  | ||||||
|     <Reference Include="System.Web.Entity" /> |  | ||||||
|     <Reference Include="System.Web.ApplicationServices" /> |  | ||||||
|     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> |  | ||||||
|       <Private>True</Private> |  | ||||||
|       <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="AspNet.ScriptManager.bootstrap"> |  | ||||||
|       <HintPath>..\packages\AspNet.ScriptManager.bootstrap.3.0.0\lib\net45\AspNet.ScriptManager.bootstrap.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="AspNet.ScriptManager.jQuery"> |  | ||||||
|       <HintPath>..\packages\AspNet.ScriptManager.jQuery.1.10.2\lib\net45\AspNet.ScriptManager.jQuery.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.ScriptManager.MSAjax"> |  | ||||||
|       <HintPath>..\packages\Microsoft.AspNet.ScriptManager.MSAjax.5.0.0\lib\net45\Microsoft.ScriptManager.MSAjax.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.ScriptManager.WebForms"> |  | ||||||
|       <HintPath>..\packages\Microsoft.AspNet.ScriptManager.WebForms.5.0.0\lib\net45\Microsoft.ScriptManager.WebForms.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> |  | ||||||
|       <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="WebGrease"> |  | ||||||
|       <Private>True</Private> |  | ||||||
|       <HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Antlr3.Runtime"> |  | ||||||
|       <Private>True</Private> |  | ||||||
|       <HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AspNet.Web.Optimization.WebForms"> |  | ||||||
|       <Private>True</Private> |  | ||||||
|       <HintPath>..\packages\Microsoft.AspNet.Web.Optimization.WebForms.1.1.3\lib\net45\Microsoft.AspNet.Web.Optimization.WebForms.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AspNet.FriendlyUrls"> |  | ||||||
|       <HintPath>..\packages\Microsoft.AspNet.FriendlyUrls.Core.1.0.2\lib\net45\Microsoft.AspNet.FriendlyUrls.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Reference Include="Newtonsoft.Json"> |  | ||||||
|       <HintPath>..\packages\Newtonsoft.Json.6.0.4\lib\net45\Newtonsoft.Json.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.ApplicationInsights"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AI.Agent.Intercept"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.6\lib\net45\Microsoft.AI.Agent.Intercept.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AI.DependencyCollector"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.2.0\lib\net45\Microsoft.AI.DependencyCollector.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AI.PerfCounterCollector"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AI.ServerTelemetryChannel"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AI.WindowsServer"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.WindowsServer.2.2.0\lib\net45\Microsoft.AI.WindowsServer.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|     <Reference Include="Microsoft.AI.Web"> |  | ||||||
|       <HintPath>..\packages\Microsoft.ApplicationInsights.Web.2.2.0\lib\net45\Microsoft.AI.Web.dll</HintPath> |  | ||||||
|     </Reference> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Content Include="About.aspx" /> |  | ||||||
|     <Content Include="Contact.aspx" /> |  | ||||||
|     <Content Include="Content\bootstrap.css" /> |  | ||||||
|     <Content Include="Content\bootstrap.min.css" /> |  | ||||||
|     <Content Include="Content\fake_product_01.png" /> |  | ||||||
|     <Content Include="Content\fake_product_02.png" /> |  | ||||||
|     <Content Include="Content\fake_product_03.png" /> |  | ||||||
|     <Content Include="Content\fake_product_04.png" /> |  | ||||||
|     <Content Include="Content\fake_product_05.png" /> |  | ||||||
|     <Content Include="Content\Site.css" /> |  | ||||||
|     <Content Include="Default.aspx" /> |  | ||||||
|     <Content Include="favicon.ico" /> |  | ||||||
|     <Content Include="fonts\glyphicons-halflings-regular.svg" /> |  | ||||||
|     <Content Include="Global.asax" /> |  | ||||||
|     <Content Include="fonts\glyphicons-halflings-regular.woff" /> |  | ||||||
|     <Content Include="fonts\glyphicons-halflings-regular.ttf" /> |  | ||||||
|     <Content Include="fonts\glyphicons-halflings-regular.eot" /> |  | ||||||
|     <Content Include="ApplicationInsights.config"> |  | ||||||
|       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |  | ||||||
|     </Content> |  | ||||||
|     <None Include="Dockerfile" /> |  | ||||||
|     <None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> |  | ||||||
|     <None Include="Scripts\jquery-1.10.2.intellisense.js" /> |  | ||||||
|     <Content Include="Scripts\bootstrap.js" /> |  | ||||||
|     <Content Include="Scripts\bootstrap.min.js" /> |  | ||||||
|     <Content Include="Scripts\jquery-1.10.2.js" /> |  | ||||||
|     <Content Include="Scripts\jquery-1.10.2.min.js" /> |  | ||||||
|     <Content Include="Scripts\modernizr-2.6.2.js" /> |  | ||||||
|     <Content Include="Scripts\respond.js" /> |  | ||||||
|     <Content Include="Scripts\respond.min.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\DetailsView.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\Focus.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\GridView.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\Menu.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MenuStandards.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjax.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxApplicationServices.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxComponentModel.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxCore.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxGlobalization.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxHistory.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxNetwork.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxSerialization.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxTimer.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxWebForms.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxWebServices.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\SmartNav.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\TreeView.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\WebForms.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\WebParts.js" /> |  | ||||||
|     <Content Include="Scripts\WebForms\WebUIValidation.js" /> |  | ||||||
|     <Content Include="Site.Master" /> |  | ||||||
|     <Content Include="ViewSwitcher.ascx" /> |  | ||||||
|     <Content Include="Web.config" /> |  | ||||||
|     <Content Include="Bundle.config" /> |  | ||||||
|     <Content Include="Site.Mobile.Master" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Compile Include="App_Start\BundleConfig.cs" /> |  | ||||||
|     <Compile Include="About.aspx.cs"> |  | ||||||
|       <DependentUpon>About.aspx</DependentUpon> |  | ||||||
|       <SubType>ASPXCodeBehind</SubType> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="About.aspx.designer.cs"> |  | ||||||
|       <DependentUpon>About.aspx</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="App_Start\RouteConfig.cs" /> |  | ||||||
|     <Compile Include="Contact.aspx.cs"> |  | ||||||
|       <DependentUpon>Contact.aspx</DependentUpon> |  | ||||||
|       <SubType>ASPXCodeBehind</SubType> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Contact.aspx.designer.cs"> |  | ||||||
|       <DependentUpon>Contact.aspx</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Default.aspx.cs"> |  | ||||||
|       <DependentUpon>Default.aspx</DependentUpon> |  | ||||||
|       <SubType>ASPXCodeBehind</SubType> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Default.aspx.designer.cs"> |  | ||||||
|       <DependentUpon>Default.aspx</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Extensions\ObservableExtensions.cs" /> |  | ||||||
|     <Compile Include="Global.asax.cs"> |  | ||||||
|       <DependentUpon>Global.asax</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Models\CatalogBrand.cs" /> |  | ||||||
|     <Compile Include="Models\CatalogItem.cs" /> |  | ||||||
|     <Compile Include="Models\CatalogRoot.cs" /> |  | ||||||
|     <Compile Include="Models\CatalogType.cs" /> |  | ||||||
|     <Compile Include="Modules\AutoFacHttpModule.cs" /> |  | ||||||
|     <Compile Include="Properties\AssemblyInfo.cs" /> |  | ||||||
|     <Compile Include="Services\CatalogMockService.cs" /> |  | ||||||
|     <Compile Include="Services\CatalogService.cs" /> |  | ||||||
|     <Compile Include="Services\Common.cs" /> |  | ||||||
|     <Compile Include="Services\ICatalogService.cs" /> |  | ||||||
|     <Compile Include="Services\IRouteProvider.cs" /> |  | ||||||
|     <Compile Include="Site.Master.cs"> |  | ||||||
|       <DependentUpon>Site.Master</DependentUpon> |  | ||||||
|       <SubType>ASPXCodeBehind</SubType> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Site.Master.designer.cs"> |  | ||||||
|       <DependentUpon>Site.Master</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Site.Mobile.Master.cs"> |  | ||||||
|       <DependentUpon>Site.Mobile.Master</DependentUpon> |  | ||||||
|       <SubType>ASPXCodeBehind</SubType> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="Site.Mobile.Master.designer.cs"> |  | ||||||
|       <DependentUpon>Site.Mobile.Master</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="ViewSwitcher.ascx.cs"> |  | ||||||
|       <DependentUpon>ViewSwitcher.ascx</DependentUpon> |  | ||||||
|       <SubType>ASPXCodeBehind</SubType> |  | ||||||
|     </Compile> |  | ||||||
|     <Compile Include="ViewSwitcher.ascx.designer.cs"> |  | ||||||
|       <DependentUpon>ViewSwitcher.ascx</DependentUpon> |  | ||||||
|     </Compile> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Folder Include="App_Data\" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Content Include="packages.config" /> |  | ||||||
|     <Content Include="Scripts\jquery-1.10.2.min.map" /> |  | ||||||
|     <None Include="Web.Debug.config"> |  | ||||||
|       <DependentUpon>Web.config</DependentUpon> |  | ||||||
|     </None> |  | ||||||
|     <None Include="Web.Release.config"> |  | ||||||
|       <DependentUpon>Web.config</DependentUpon> |  | ||||||
|     </None> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <PropertyGroup> |  | ||||||
|     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion> |  | ||||||
|     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |  | ||||||
|   <Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" /> |  | ||||||
|   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" /> |  | ||||||
|   <ProjectExtensions> |  | ||||||
|     <VisualStudio> |  | ||||||
|       <FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}"> |  | ||||||
|         <WebProjectProperties> |  | ||||||
|           <UseIIS>True</UseIIS> |  | ||||||
|           <AutoAssignPort>True</AutoAssignPort> |  | ||||||
|           <DevelopmentServerPort>58178</DevelopmentServerPort> |  | ||||||
|           <DevelopmentServerVPath>/</DevelopmentServerVPath> |  | ||||||
|           <IISUrl>http://localhost:58178/</IISUrl> |  | ||||||
|           <NTLMAuthentication>False</NTLMAuthentication> |  | ||||||
|           <UseCustomServer>False</UseCustomServer> |  | ||||||
|           <CustomServerUrl> |  | ||||||
|           </CustomServerUrl> |  | ||||||
|           <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile> |  | ||||||
|         </WebProjectProperties> |  | ||||||
|       </FlavorProperties> |  | ||||||
|     </VisualStudio> |  | ||||||
|   </ProjectExtensions> |  | ||||||
|   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> |  | ||||||
|     <PropertyGroup> |  | ||||||
|       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> |  | ||||||
|     </PropertyGroup> |  | ||||||
|     <Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" /> |  | ||||||
|     <Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.0.1\build\Microsoft.Net.Compilers.props'))" /> |  | ||||||
|   </Target> |  | ||||||
|   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.  |  | ||||||
|        Other similar extension points exist, see Microsoft.Common.targets. |  | ||||||
|   <Target Name="BeforeBuild"> |  | ||||||
|   </Target> |  | ||||||
|   <Target Name="AfterBuild"> |  | ||||||
|   </Target> |  | ||||||
|   --> |  | ||||||
| </Project> |  | ||||||
| @ -1,45 +0,0 @@ | |||||||
| using Autofac; |  | ||||||
| using Autofac.Core; |  | ||||||
| using eShopOnContainers.Core.Models.Catalog; |  | ||||||
| using eShopOnContainers.Core.Services.Catalog; |  | ||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| using System.Web; |  | ||||||
| using System.Web.UI; |  | ||||||
| using System.Web.UI.WebControls; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopOnContainers.Catalog.WebForms |  | ||||||
| { |  | ||||||
|     public partial class _Default : Page |  | ||||||
|     { |  | ||||||
|         private ICatalogService catalog; |  | ||||||
| 
 |  | ||||||
|         protected _Default() { } |  | ||||||
| 
 |  | ||||||
|         public _Default(ICatalogService catalog) |  | ||||||
|         { |  | ||||||
|             this.catalog = catalog; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         protected override void OnLoad(EventArgs e) |  | ||||||
|         { |  | ||||||
|             RegisterAsyncTask(new PageAsyncTask(LoadCatalogDataAsync)); |  | ||||||
| 
 |  | ||||||
|             base.OnLoad(e); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         private async Task LoadCatalogDataAsync() |  | ||||||
|         { |  | ||||||
|             var collection = await catalog?.GetCatalogAsync(); |  | ||||||
|             catalogList.DataSource = collection; |  | ||||||
|             catalogList.DataBind(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         protected void Page_Load(object sender, EventArgs e) |  | ||||||
|         { |  | ||||||
| 
 |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,19 +0,0 @@ | |||||||
| using System; |  | ||||||
| using System.Web; |  | ||||||
| using System.Web.Optimization; |  | ||||||
| using System.Web.Routing; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopOnContainers.Catalog.WebForms |  | ||||||
| { |  | ||||||
|     public class Global : HttpApplication |  | ||||||
|     { |  | ||||||
| 
 |  | ||||||
|         void Application_Start(object sender, EventArgs e) |  | ||||||
|         { |  | ||||||
|             // Code that runs on application startup |  | ||||||
|             RouteConfig.RegisterRoutes(RouteTable.Routes); |  | ||||||
|             BundleConfig.RegisterBundles(BundleTable.Bundles); |  | ||||||
| 
 |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,83 +0,0 @@ | |||||||
| using Autofac; |  | ||||||
| using eShopOnContainers.Core.Services.Catalog; |  | ||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Web; |  | ||||||
| using System.Web.Configuration; |  | ||||||
| using System.Web.UI; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopOnContainers.Catalog.WebForms.Modules |  | ||||||
| { |  | ||||||
|     // Using DI with WebForms is not yet implemented. |  | ||||||
|     // This implementation has been adapted from this post: |  | ||||||
|     // https://blogs.msdn.microsoft.com/webdev/2016/10/19/modern-asp-net-web-forms-development-dependency-injection/ |  | ||||||
| 
 |  | ||||||
|     public class AutoFacHttpModule : IHttpModule |  | ||||||
|     { |  | ||||||
|         private static IContainer Container => lazyContainer.Value; |  | ||||||
| 
 |  | ||||||
|         private static Lazy<IContainer> lazyContainer = new Lazy<IContainer>(() => CreateContainer()); |  | ||||||
| 
 |  | ||||||
|         private static IContainer CreateContainer() |  | ||||||
|         { |  | ||||||
|             // Configure AutoFac: |  | ||||||
|             // Register Containers: |  | ||||||
|             var settings = WebConfigurationManager.AppSettings; |  | ||||||
|             var useFake = settings["usefake"]; |  | ||||||
|             bool fake = useFake == "true"; |  | ||||||
|             var builder = new ContainerBuilder(); |  | ||||||
|             if (fake) |  | ||||||
|             { |  | ||||||
|                 builder.RegisterType<CatalogMockService>() |  | ||||||
|                     .As<ICatalogService>(); |  | ||||||
|             } |  | ||||||
|             else |  | ||||||
|             { |  | ||||||
|                 builder.RegisterType<CatalogMockService>() |  | ||||||
|                     .As<ICatalogService>(); |  | ||||||
|             } |  | ||||||
|             var container = builder.Build(); |  | ||||||
|             return container; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public void Dispose() |  | ||||||
|         { |  | ||||||
|             Container.Dispose(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public void Init(HttpApplication context) |  | ||||||
|         { |  | ||||||
|             context.PreRequestHandlerExecute += (_, __) => InjectDependencies(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         private void InjectDependencies() |  | ||||||
|         { |  | ||||||
|             if  (HttpContext.Current.CurrentHandler is Page page) |  | ||||||
|             { |  | ||||||
|                 // Get the code-behind class that we may have written |  | ||||||
|                 var pageType = page.GetType().BaseType; |  | ||||||
| 
 |  | ||||||
|                 // Determine if there is a constructor to inject, and grab it |  | ||||||
|                 var ctor = (from c in pageType.GetConstructors() |  | ||||||
|                             where c.GetParameters().Length > 0 |  | ||||||
|                             select c).FirstOrDefault(); |  | ||||||
| 
 |  | ||||||
|                 if (ctor != null) |  | ||||||
|                 { |  | ||||||
|                     // Resolve the parameters for the constructor |  | ||||||
|                     var args = (from parm in ctor.GetParameters() |  | ||||||
|                                 select Container.Resolve(parm.ParameterType)) |  | ||||||
|                                 .ToArray(); |  | ||||||
| 
 |  | ||||||
|                     // Execute the constructor method with the arguments resolved  |  | ||||||
|                     ctor.Invoke(page, args); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 // Use the Autofac method to inject any properties that can be filled by Autofac |  | ||||||
|                 Container.InjectProperties(page); |  | ||||||
| 
 |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,54 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <!-- |  | ||||||
|   For more information on how to configure your ASP.NET application, please visit |  | ||||||
|   https://go.microsoft.com/fwlink/?LinkId=169433 |  | ||||||
|   --> |  | ||||||
| <configuration> |  | ||||||
|   <appSettings> |  | ||||||
|     <add key="usefake" value="true" /> |  | ||||||
|   </appSettings> |  | ||||||
|   <system.web> |  | ||||||
|     <compilation debug="true" targetFramework="4.5.2" /> |  | ||||||
|     <httpRuntime targetFramework="4.5.2" /> |  | ||||||
|     <pages> |  | ||||||
|       <namespaces> |  | ||||||
|         <add namespace="System.Web.Optimization" /> |  | ||||||
|       </namespaces> |  | ||||||
|       <controls> |  | ||||||
|         <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /> |  | ||||||
|       </controls> |  | ||||||
|     </pages> |  | ||||||
|     <httpModules> |  | ||||||
|       <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" /> |  | ||||||
|       <!--  Use this if you are on IIS 7 and earlier --> |  | ||||||
|       <add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" /> |  | ||||||
|     </httpModules> |  | ||||||
|   </system.web> |  | ||||||
|   <runtime> |  | ||||||
|     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> |  | ||||||
|       <dependentAssembly> |  | ||||||
|         <assemblyIdentity name="Newtonsoft.Json" culture="neutral" publicKeyToken="30ad4fe6b2a6aeed" /> |  | ||||||
|         <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> |  | ||||||
|       </dependentAssembly> |  | ||||||
|       <dependentAssembly> |  | ||||||
|         <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3856ad364e35" /> |  | ||||||
|         <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> |  | ||||||
|       </dependentAssembly>       |  | ||||||
|     </assemblyBinding> |  | ||||||
|   </runtime> |  | ||||||
|   <system.webServer> |  | ||||||
|     <validation validateIntegratedModeConfiguration="false" /> |  | ||||||
|     <modules> |  | ||||||
|       <remove name="ApplicationInsightsWebTracking" /> |  | ||||||
|       <add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" /> |  | ||||||
|       <!-- Use this if you are on IIS 8 and later --> |  | ||||||
|       <add name="InjectModule" type="Microsoft.eShopOnContainers.Catalog.WebForms.Modules.AutoFacHttpModule, Catalog.WebForms" /> |  | ||||||
|     </modules> |  | ||||||
|   </system.webServer> |  | ||||||
|   <system.codedom> |  | ||||||
|     <compilers> |  | ||||||
|       <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" /> |  | ||||||
|       <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" /> |  | ||||||
|     </compilers> |  | ||||||
|   </system.codedom> |  | ||||||
| </configuration> |  | ||||||
| @ -1,29 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <packages> |  | ||||||
|   <package id="Antlr" version="3.4.1.9004" targetFramework="net452" /> |  | ||||||
|   <package id="AspNet.ScriptManager.bootstrap" version="3.0.0" targetFramework="net452" /> |  | ||||||
|   <package id="AspNet.ScriptManager.jQuery" version="1.10.2" targetFramework="net452" /> |  | ||||||
|   <package id="Autofac" version="4.3.0" targetFramework="net452" /> |  | ||||||
|   <package id="bootstrap" version="3.0.0" targetFramework="net452" /> |  | ||||||
|   <package id="jQuery" version="1.10.2" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights" version="2.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.0.6" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights.Web" version="2.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights.WindowsServer" version="2.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.AspNet.FriendlyUrls" version="1.0.2" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.AspNet.FriendlyUrls.Core" version="1.0.2" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.AspNet.ScriptManager.MSAjax" version="5.0.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.AspNet.ScriptManager.WebForms" version="5.0.0" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.AspNet.Web.Optimization.WebForms" version="1.1.3" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net452" /> |  | ||||||
|   <package id="Microsoft.Net.Compilers" version="2.0.1" targetFramework="net452" developmentDependency="true" /> |  | ||||||
|   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" /> |  | ||||||
|   <package id="Modernizr" version="2.6.2" targetFramework="net452" /> |  | ||||||
|   <package id="Newtonsoft.Json" version="6.0.4" targetFramework="net452" /> |  | ||||||
|   <package id="Respond" version="1.2.0" targetFramework="net452" /> |  | ||||||
|   <package id="WebGrease" version="1.5.2" targetFramework="net452" /> |  | ||||||
| </packages> |  | ||||||
| @ -1,9 +0,0 @@ | |||||||
| version: '2' |  | ||||||
| 
 |  | ||||||
| services: |  | ||||||
|   ci-build: |  | ||||||
|     image: microsoft/aspnetcore-build:1.0-1.1 |  | ||||||
|     volumes: |  | ||||||
|       - .:/src |  | ||||||
|     working_dir: /src |  | ||||||
|     command: /bin/bash -c "dotnet restore ./eShopWeb.sln && dotnet publish ./eShopWeb.sln -c Release -o ./obj/Docker/publish" |  | ||||||
| @ -1,22 +0,0 @@ | |||||||
| <?xml version="1.0" encoding="utf-8"?> |  | ||||||
| <Project ToolsVersion="15.0" Sdk="Microsoft.Docker.Sdk"> |  | ||||||
|   <PropertyGroup Label="Globals"> |  | ||||||
|     <ProjectGuid>91cd7b6e-a849-48c1-b058-4bc47c4cd978</ProjectGuid> |  | ||||||
|     <DockerLaunchBrowser>True</DockerLaunchBrowser> |  | ||||||
|     <DockerServiceUrl>http://localhost:{ServicePort}</DockerServiceUrl> |  | ||||||
|     <DockerServiceName>eshopweb</DockerServiceName> |  | ||||||
|   </PropertyGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <None Include="docker-compose.ci.build.yml" /> |  | ||||||
|     <None Include="docker-compose.override.yml"> |  | ||||||
|       <DependentUpon>docker-compose.yml</DependentUpon> |  | ||||||
|     </None> |  | ||||||
|     <None Include="docker-compose.vs.debug.yml"> |  | ||||||
|       <DependentUpon>docker-compose.yml</DependentUpon> |  | ||||||
|     </None> |  | ||||||
|     <None Include="docker-compose.vs.release.yml"> |  | ||||||
|       <DependentUpon>docker-compose.yml</DependentUpon> |  | ||||||
|     </None> |  | ||||||
|     <None Include="docker-compose.yml" /> |  | ||||||
|   </ItemGroup> |  | ||||||
| </Project> |  | ||||||
| @ -1,17 +0,0 @@ | |||||||
| version: '2' |  | ||||||
| 
 |  | ||||||
| services: |  | ||||||
|   eshopweb: |  | ||||||
|     environment: |  | ||||||
|       - ASPNETCORE_ENVIRONMENT=Development |  | ||||||
|       - ConnectionString=Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word |  | ||||||
|       - CatalogBaseUrl=http://localhost:5106 |  | ||||||
|     ports: |  | ||||||
|       - "5106:5106" |  | ||||||
| 
 |  | ||||||
|   sql.data: |  | ||||||
|     environment: |  | ||||||
|       - MSSQL_SA_PASSWORD=Pass@word |  | ||||||
|       - ACCEPT_EULA=Y |  | ||||||
|     ports: |  | ||||||
|       - "5433:1433" |  | ||||||
| @ -1,17 +0,0 @@ | |||||||
| version: '2' |  | ||||||
| 
 |  | ||||||
| services: |  | ||||||
|   eshopweb: |  | ||||||
|     image: eshop/web:dev |  | ||||||
|     build: |  | ||||||
|       args: |  | ||||||
|         source: ${DOCKER_BUILD_SOURCE} |  | ||||||
|     environment: |  | ||||||
|       - DOTNET_USE_POLLING_FILE_WATCHER=1 |  | ||||||
|     volumes: |  | ||||||
|       - ./eShopWeb:/app |  | ||||||
|       - ~/.nuget/packages:/root/.nuget/packages:ro |  | ||||||
|       - ~/clrdbg:/clrdbg:ro |  | ||||||
|     entrypoint: tail -f /dev/null |  | ||||||
|     labels: |  | ||||||
|       - "com.microsoft.visualstudio.targetoperatingsystem=linux" |  | ||||||
| @ -1,12 +0,0 @@ | |||||||
| version: '2' |  | ||||||
| 
 |  | ||||||
| services: |  | ||||||
|   eshopweb: |  | ||||||
|     build: |  | ||||||
|       args: |  | ||||||
|         source: ${DOCKER_BUILD_SOURCE} |  | ||||||
|     volumes: |  | ||||||
|       - ~/clrdbg:/clrdbg:ro |  | ||||||
|     entrypoint: tail -f /dev/null |  | ||||||
|     labels: |  | ||||||
|       - "com.microsoft.visualstudio.targetoperatingsystem=linux" |  | ||||||
| @ -1,12 +0,0 @@ | |||||||
| version: '2' |  | ||||||
| 
 |  | ||||||
| services: |  | ||||||
|   eshopweb: |  | ||||||
|     image: eshop/web |  | ||||||
|     build: |  | ||||||
|       context: ./eShopWeb |  | ||||||
|       dockerfile: Dockerfile |  | ||||||
|     depends_on: |  | ||||||
|       - sql.data |  | ||||||
|   sql.data: |  | ||||||
|     image: microsoft/mssql-server-linux:2017-latest |  | ||||||
| @ -1,48 +0,0 @@ | |||||||
|  |  | ||||||
| Microsoft Visual Studio Solution File, Format Version 12.00 |  | ||||||
| # Visual Studio 15 |  | ||||||
| VisualStudioVersion = 15.0.26228.0 |  | ||||||
| MinimumVisualStudioVersion = 10.0.40219.1 |  | ||||||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "eShopWeb", "eShopWeb\eShopWeb.csproj", "{CA5B730B-7195-4E29-B030-A2007E004B98}" |  | ||||||
| EndProject |  | ||||||
| Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{91CD7B6E-A849-48C1-B058-4BC47C4CD978}" |  | ||||||
| EndProject |  | ||||||
| Global |  | ||||||
| 	GlobalSection(SolutionConfigurationPlatforms) = preSolution |  | ||||||
| 		Debug|Any CPU = Debug|Any CPU |  | ||||||
| 		Debug|x64 = Debug|x64 |  | ||||||
| 		Debug|x86 = Debug|x86 |  | ||||||
| 		Release|Any CPU = Release|Any CPU |  | ||||||
| 		Release|x64 = Release|x64 |  | ||||||
| 		Release|x86 = Release|x86 |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(ProjectConfigurationPlatforms) = postSolution |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|Any CPU.Build.0 = Debug|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x64.ActiveCfg = Debug|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x64.Build.0 = Debug|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x86.ActiveCfg = Debug|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Debug|x86.Build.0 = Debug|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|Any CPU.ActiveCfg = Release|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|Any CPU.Build.0 = Release|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x64.ActiveCfg = Release|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x64.Build.0 = Release|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x86.ActiveCfg = Release|Any CPU |  | ||||||
| 		{CA5B730B-7195-4E29-B030-A2007E004B98}.Release|x86.Build.0 = Release|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Debug|Any CPU.Build.0 = Debug|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Debug|x64.ActiveCfg = Debug|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Debug|x64.Build.0 = Debug|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Debug|x86.ActiveCfg = Debug|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Debug|x86.Build.0 = Debug|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Release|Any CPU.ActiveCfg = Release|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Release|Any CPU.Build.0 = Release|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Release|x64.ActiveCfg = Release|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Release|x64.Build.0 = Release|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Release|x86.ActiveCfg = Release|Any CPU |  | ||||||
| 		{91CD7B6E-A849-48C1-B058-4BC47C4CD978}.Release|x86.Build.0 = Release|Any CPU |  | ||||||
| 	EndGlobalSection |  | ||||||
| 	GlobalSection(SolutionProperties) = preSolution |  | ||||||
| 		HideSolutionNode = FALSE |  | ||||||
| 	EndGlobalSection |  | ||||||
| EndGlobal |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| { |  | ||||||
|   "directory": "wwwroot/lib" |  | ||||||
| } |  | ||||||
| @ -1,7 +0,0 @@ | |||||||
| namespace Microsoft.eShopWeb |  | ||||||
| { |  | ||||||
|     public class CatalogSettings |  | ||||||
|     { |  | ||||||
|         public string CatalogBaseUrl { get; set; } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,70 +0,0 @@ | |||||||
| using Microsoft.eShopWeb.Services; |  | ||||||
| using Microsoft.eShopWeb.ViewModels; |  | ||||||
| using Microsoft.AspNetCore.Hosting; |  | ||||||
| using Microsoft.AspNetCore.Mvc; |  | ||||||
| using System; |  | ||||||
| using System.IO; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 |  | ||||||
| // For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Controllers |  | ||||||
| { |  | ||||||
|     public class CatalogController : Controller |  | ||||||
|     { |  | ||||||
|         private readonly IHostingEnvironment _env; |  | ||||||
|         private readonly ICatalogService _catalogSvc; |  | ||||||
| 
 |  | ||||||
|         public CatalogController(IHostingEnvironment env, ICatalogService catalogSvc) |  | ||||||
|         { |  | ||||||
|             _env = env; |  | ||||||
|             _catalogSvc = catalogSvc; |  | ||||||
|         }    |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|         // GET: /<controller>/ |  | ||||||
|         public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page) |  | ||||||
|         { |  | ||||||
|             var itemsPage = 10;            |  | ||||||
|             var catalog = await _catalogSvc.GetCatalogItems(page ?? 0, itemsPage, BrandFilterApplied, TypesFilterApplied);         |  | ||||||
| 
 |  | ||||||
|             var vm = new CatalogIndex() |  | ||||||
|             { |  | ||||||
|                 CatalogItems = catalog.Data, |  | ||||||
|                 Brands = await _catalogSvc.GetBrands(), |  | ||||||
|                 Types = await _catalogSvc.GetTypes(), |  | ||||||
|                 BrandFilterApplied = BrandFilterApplied ?? 0, |  | ||||||
|                 TypesFilterApplied = TypesFilterApplied ?? 0, |  | ||||||
|                 PaginationInfo = new PaginationInfo() |  | ||||||
|                 { |  | ||||||
|                     ActualPage = page ?? 0, |  | ||||||
|                     ItemsPerPage = catalog.Data.Count, |  | ||||||
|                     TotalItems = catalog.Count, |  | ||||||
|                     TotalPages = int.Parse(Math.Ceiling(((decimal)catalog.Count / itemsPage)).ToString()) |  | ||||||
|                 } |  | ||||||
|             }; |  | ||||||
| 
 |  | ||||||
|             vm.PaginationInfo.Next = (vm.PaginationInfo.ActualPage == vm.PaginationInfo.TotalPages - 1) ? "is-disabled" : ""; |  | ||||||
|             vm.PaginationInfo.Previous = (vm.PaginationInfo.ActualPage == 0) ? "is-disabled" : ""; |  | ||||||
| 
 |  | ||||||
|             return View(vm); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         [HttpGet("{id}")] |  | ||||||
|         [Route("[controller]/pic/{id}")]
 |  | ||||||
|         // GET: /<controller>/pic/{id} |  | ||||||
|         public IActionResult GetImage(int id) |  | ||||||
|         { |  | ||||||
|             var contentRoot = _env.ContentRootPath + "//Pics"; |  | ||||||
|             var path = Path.Combine(contentRoot, id + ".png"); |  | ||||||
|             Byte[] b = System.IO.File.ReadAllBytes(path); |  | ||||||
|             return File(b, "image/png"); |  | ||||||
| 
 |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         public IActionResult Error() |  | ||||||
|         { |  | ||||||
|             return View(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,6 +0,0 @@ | |||||||
| FROM microsoft/aspnetcore:1.1 |  | ||||||
| ARG source |  | ||||||
| WORKDIR /app |  | ||||||
| EXPOSE 80 |  | ||||||
| COPY ${source:-obj/Docker/publish} . |  | ||||||
| ENTRYPOINT ["dotnet", "eShopWeb.dll"] |  | ||||||
| @ -1,79 +0,0 @@ | |||||||
| namespace Microsoft.eShopWeb.Infrastructure |  | ||||||
| { |  | ||||||
|     using eShopWeb.Models; |  | ||||||
|     using Microsoft.EntityFrameworkCore; |  | ||||||
|     using Microsoft.EntityFrameworkCore.Metadata.Builders; |  | ||||||
| 
 |  | ||||||
|     public class CatalogContext : DbContext |  | ||||||
|     { |  | ||||||
|         public CatalogContext(DbContextOptions options) : base(options) |  | ||||||
|         { |  | ||||||
|         } |  | ||||||
|         public DbSet<CatalogItem> CatalogItems { get; set; } |  | ||||||
|         public DbSet<CatalogBrand> CatalogBrands { get; set; } |  | ||||||
|         public DbSet<CatalogType> CatalogTypes { get; set; } |  | ||||||
|         protected override void OnModelCreating(ModelBuilder builder) |  | ||||||
|         { |  | ||||||
|             builder.Entity<CatalogBrand>(ConfigureCatalogBrand); |  | ||||||
|             builder.Entity<CatalogType>(ConfigureCatalogType); |  | ||||||
|             builder.Entity<CatalogItem>(ConfigureCatalogItem); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         void ConfigureCatalogItem(EntityTypeBuilder<CatalogItem> builder) |  | ||||||
|         { |  | ||||||
|             builder.ToTable("Catalog"); |  | ||||||
| 
 |  | ||||||
|             builder.Property(ci => ci.Id) |  | ||||||
|                 .ForSqlServerUseSequenceHiLo("catalog_hilo") |  | ||||||
|                 .IsRequired(); |  | ||||||
| 
 |  | ||||||
|             builder.Property(ci => ci.Name) |  | ||||||
|                 .IsRequired(true) |  | ||||||
|                 .HasMaxLength(50); |  | ||||||
| 
 |  | ||||||
|             builder.Property(ci => ci.Price) |  | ||||||
|                 .IsRequired(true); |  | ||||||
| 
 |  | ||||||
|             builder.Property(ci => ci.PictureUri) |  | ||||||
|                 .IsRequired(false); |  | ||||||
| 
 |  | ||||||
|             builder.HasOne(ci => ci.CatalogBrand) |  | ||||||
|                 .WithMany() |  | ||||||
|                 .HasForeignKey(ci => ci.CatalogBrandId); |  | ||||||
| 
 |  | ||||||
|             builder.HasOne(ci => ci.CatalogType) |  | ||||||
|                 .WithMany() |  | ||||||
|                 .HasForeignKey(ci => ci.CatalogTypeId); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         void ConfigureCatalogBrand(EntityTypeBuilder<CatalogBrand> builder) |  | ||||||
|         { |  | ||||||
|             builder.ToTable("CatalogBrand"); |  | ||||||
| 
 |  | ||||||
|             builder.HasKey(ci => ci.Id); |  | ||||||
| 
 |  | ||||||
|             builder.Property(ci => ci.Id) |  | ||||||
|                .ForSqlServerUseSequenceHiLo("catalog_brand_hilo") |  | ||||||
|                .IsRequired(); |  | ||||||
| 
 |  | ||||||
|             builder.Property(cb => cb.Brand) |  | ||||||
|                 .IsRequired() |  | ||||||
|                 .HasMaxLength(100); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         void ConfigureCatalogType(EntityTypeBuilder<CatalogType> builder) |  | ||||||
|         { |  | ||||||
|             builder.ToTable("CatalogType"); |  | ||||||
| 
 |  | ||||||
|             builder.HasKey(ci => ci.Id); |  | ||||||
| 
 |  | ||||||
|             builder.Property(ci => ci.Id) |  | ||||||
|                .ForSqlServerUseSequenceHiLo("catalog_type_hilo") |  | ||||||
|                .IsRequired(); |  | ||||||
| 
 |  | ||||||
|             builder.Property(cb => cb.Type) |  | ||||||
|                 .IsRequired() |  | ||||||
|                 .HasMaxLength(100); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,102 +0,0 @@ | |||||||
| namespace Microsoft.eShopWeb.Infrastructure |  | ||||||
| { |  | ||||||
|     using eShopWeb.Models; |  | ||||||
|     using Microsoft.AspNetCore.Builder; |  | ||||||
|     using Microsoft.EntityFrameworkCore; |  | ||||||
|     using Microsoft.Extensions.Logging; |  | ||||||
|     using System; |  | ||||||
|     using System.Collections.Generic; |  | ||||||
|     using System.Linq; |  | ||||||
|     using System.Threading.Tasks; |  | ||||||
| 
 |  | ||||||
|     public class CatalogContextSeed |  | ||||||
|     { |  | ||||||
|         public static async Task SeedAsync(IApplicationBuilder applicationBuilder, ILoggerFactory loggerFactory, int? retry = 0) |  | ||||||
|         { |  | ||||||
|             int retryForAvaiability = retry.Value; |  | ||||||
|             try |  | ||||||
|             { |  | ||||||
|                 var context = (CatalogContext)applicationBuilder |  | ||||||
|                     .ApplicationServices.GetService(typeof(CatalogContext)); |  | ||||||
| 
 |  | ||||||
|                 context.Database.Migrate();                 |  | ||||||
| 
 |  | ||||||
|                 if (!context.CatalogBrands.Any()) |  | ||||||
|                 { |  | ||||||
|                     context.CatalogBrands.AddRange( |  | ||||||
|                         GetPreconfiguredCatalogBrands()); |  | ||||||
| 
 |  | ||||||
|                     await context.SaveChangesAsync(); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (!context.CatalogTypes.Any()) |  | ||||||
|                 { |  | ||||||
|                     context.CatalogTypes.AddRange( |  | ||||||
|                         GetPreconfiguredCatalogTypes()); |  | ||||||
| 
 |  | ||||||
|                     await context.SaveChangesAsync(); |  | ||||||
|                 } |  | ||||||
| 
 |  | ||||||
|                 if (!context.CatalogItems.Any()) |  | ||||||
|                 { |  | ||||||
|                     context.CatalogItems.AddRange( |  | ||||||
|                         GetPreconfiguredItems()); |  | ||||||
| 
 |  | ||||||
|                     await context.SaveChangesAsync(); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             catch (Exception ex) |  | ||||||
|             { |  | ||||||
|                 if (retryForAvaiability < 10) |  | ||||||
|                 { |  | ||||||
|                     retryForAvaiability++; |  | ||||||
|                     var log = loggerFactory.CreateLogger("catalog seed"); |  | ||||||
|                     log.LogError(ex, "EXCEPTION ERROR: {Message}", ex.Message); |  | ||||||
|                     await SeedAsync(applicationBuilder, loggerFactory, retryForAvaiability); |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         static IEnumerable<CatalogBrand> GetPreconfiguredCatalogBrands() |  | ||||||
|         { |  | ||||||
|             return new List<CatalogBrand>() |  | ||||||
|             { |  | ||||||
|                 new CatalogBrand() { Brand = "Azure"}, |  | ||||||
|                 new CatalogBrand() { Brand = ".NET" }, |  | ||||||
|                 new CatalogBrand() { Brand = "Visual Studio" }, |  | ||||||
|                 new CatalogBrand() { Brand = "SQL Server" },  |  | ||||||
|                 new CatalogBrand() { Brand = "Other" } |  | ||||||
|             }; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         static IEnumerable<CatalogType> GetPreconfiguredCatalogTypes() |  | ||||||
|         { |  | ||||||
|             return new List<CatalogType>() |  | ||||||
|             { |  | ||||||
|                 new CatalogType() { Type = "Mug"}, |  | ||||||
|                 new CatalogType() { Type = "T-Shirt" }, |  | ||||||
|                 new CatalogType() { Type = "Sheet" }, |  | ||||||
|                 new CatalogType() { Type = "USB Memory Stick" } |  | ||||||
|             }; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         static IEnumerable<CatalogItem> GetPreconfiguredItems() |  | ||||||
|         { |  | ||||||
|             return new List<CatalogItem>() |  | ||||||
|             { |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Bot Black Sweatshirt", Name = ".NET Bot Black Sweatshirt", Price = 19.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/1" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=1,CatalogBrandId=2, Description = ".NET Black & White Mug", Name = ".NET Black & White Mug", Price= 8.50M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/2" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White T-Shirt", Name = "Prism White T-Shirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/3" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Foundation Sweatshirt", Name = ".NET Foundation Sweatshirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/4" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=3,CatalogBrandId=5, Description = "Roslyn Red Sheet", Name = "Roslyn Red Sheet", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/5" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=2, Description = ".NET Blue Sweatshirt", Name = ".NET Blue Sweatshirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/6" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Roslyn Red T-Shirt", Name = "Roslyn Red T-Shirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/7"  }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Kudu Purple Sweatshirt", Name = "Kudu Purple Sweatshirt", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/8" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=1,CatalogBrandId=5, Description = "Cup<T> White Mug", Name = "Cup<T> White Mug", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/9" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = ".NET Foundation Sheet", Name = ".NET Foundation Sheet", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/10" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=3,CatalogBrandId=2, Description = "Cup<T> Sheet", Name = "Cup<T> Sheet", Price = 8.5M, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/11" }, |  | ||||||
|                 new CatalogItem() { CatalogTypeId=2,CatalogBrandId=5, Description = "Prism White TShirt", Name = "Prism White TShirt", Price = 12, PictureUri = "http://catalogbaseurltobereplaced/catalog/pic/12" } |  | ||||||
|             }; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,97 +0,0 @@ | |||||||
| using Microsoft.EntityFrameworkCore; |  | ||||||
| using Microsoft.EntityFrameworkCore.Infrastructure; |  | ||||||
| using Microsoft.EntityFrameworkCore.Metadata; |  | ||||||
| using Microsoft.EntityFrameworkCore.Migrations; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Infrastructure.Migrations |  | ||||||
| { |  | ||||||
|     [DbContext(typeof(CatalogContext))] |  | ||||||
|     [Migration("20170302162241_Initial")] |  | ||||||
|     partial class Initial |  | ||||||
|     { |  | ||||||
|         protected override void BuildTargetModel(ModelBuilder modelBuilder) |  | ||||||
|         { |  | ||||||
|             modelBuilder |  | ||||||
|                 .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") |  | ||||||
|                 .HasAnnotation("SqlServer:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'") |  | ||||||
|                 .HasAnnotation("SqlServer:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'") |  | ||||||
|                 .HasAnnotation("SqlServer:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'") |  | ||||||
|                 .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogBrand", b => |  | ||||||
|                 { |  | ||||||
|                     b.Property<int>("Id") |  | ||||||
|                         .ValueGeneratedOnAdd() |  | ||||||
|                         .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo") |  | ||||||
|                         .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Brand") |  | ||||||
|                         .IsRequired() |  | ||||||
|                         .HasMaxLength(100); |  | ||||||
| 
 |  | ||||||
|                     b.HasKey("Id"); |  | ||||||
| 
 |  | ||||||
|                     b.ToTable("CatalogBrand"); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogItem", b => |  | ||||||
|                 { |  | ||||||
|                     b.Property<int>("Id") |  | ||||||
|                         .ValueGeneratedOnAdd() |  | ||||||
|                         .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo") |  | ||||||
|                         .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); |  | ||||||
| 
 |  | ||||||
|                     b.Property<int>("CatalogBrandId"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<int>("CatalogTypeId"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Description"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Name") |  | ||||||
|                         .IsRequired() |  | ||||||
|                         .HasMaxLength(50); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("PictureUri"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<decimal>("Price"); |  | ||||||
| 
 |  | ||||||
|                     b.HasKey("Id"); |  | ||||||
| 
 |  | ||||||
|                     b.HasIndex("CatalogBrandId"); |  | ||||||
| 
 |  | ||||||
|                     b.HasIndex("CatalogTypeId"); |  | ||||||
| 
 |  | ||||||
|                     b.ToTable("Catalog"); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogType", b => |  | ||||||
|                 { |  | ||||||
|                     b.Property<int>("Id") |  | ||||||
|                         .ValueGeneratedOnAdd() |  | ||||||
|                         .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo") |  | ||||||
|                         .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Type") |  | ||||||
|                         .IsRequired() |  | ||||||
|                         .HasMaxLength(100); |  | ||||||
| 
 |  | ||||||
|                     b.HasKey("Id"); |  | ||||||
| 
 |  | ||||||
|                     b.ToTable("CatalogType"); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogItem", b => |  | ||||||
|                 { |  | ||||||
|                     b.HasOne("eShopWeb.Models.CatalogBrand", "CatalogBrand") |  | ||||||
|                         .WithMany() |  | ||||||
|                         .HasForeignKey("CatalogBrandId") |  | ||||||
|                         .OnDelete(DeleteBehavior.Cascade); |  | ||||||
| 
 |  | ||||||
|                     b.HasOne("eShopWeb.Models.CatalogType", "CatalogType") |  | ||||||
|                         .WithMany() |  | ||||||
|                         .HasForeignKey("CatalogTypeId") |  | ||||||
|                         .OnDelete(DeleteBehavior.Cascade); |  | ||||||
|                 }); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,108 +0,0 @@ | |||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using Microsoft.EntityFrameworkCore.Migrations; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Infrastructure.Migrations |  | ||||||
| { |  | ||||||
|     public partial class Initial : Migration |  | ||||||
|     { |  | ||||||
|         protected override void Up(MigrationBuilder migrationBuilder) |  | ||||||
|         { |  | ||||||
|             migrationBuilder.CreateSequence( |  | ||||||
|                 name: "catalog_brand_hilo", |  | ||||||
|                 incrementBy: 10); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateSequence( |  | ||||||
|                 name: "catalog_hilo", |  | ||||||
|                 incrementBy: 10); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateSequence( |  | ||||||
|                 name: "catalog_type_hilo", |  | ||||||
|                 incrementBy: 10); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateTable( |  | ||||||
|                 name: "CatalogBrand", |  | ||||||
|                 columns: table => new |  | ||||||
|                 { |  | ||||||
|                     Id = table.Column<int>(nullable: false), |  | ||||||
|                     Brand = table.Column<string>(maxLength: 100, nullable: false) |  | ||||||
|                 }, |  | ||||||
|                 constraints: table => |  | ||||||
|                 { |  | ||||||
|                     table.PrimaryKey("PK_CatalogBrand", x => x.Id); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateTable( |  | ||||||
|                 name: "CatalogType", |  | ||||||
|                 columns: table => new |  | ||||||
|                 { |  | ||||||
|                     Id = table.Column<int>(nullable: false), |  | ||||||
|                     Type = table.Column<string>(maxLength: 100, nullable: false) |  | ||||||
|                 }, |  | ||||||
|                 constraints: table => |  | ||||||
|                 { |  | ||||||
|                     table.PrimaryKey("PK_CatalogType", x => x.Id); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateTable( |  | ||||||
|                 name: "Catalog", |  | ||||||
|                 columns: table => new |  | ||||||
|                 { |  | ||||||
|                     Id = table.Column<int>(nullable: false), |  | ||||||
|                     CatalogBrandId = table.Column<int>(nullable: false), |  | ||||||
|                     CatalogTypeId = table.Column<int>(nullable: false), |  | ||||||
|                     Description = table.Column<string>(nullable: true), |  | ||||||
|                     Name = table.Column<string>(maxLength: 50, nullable: false), |  | ||||||
|                     PictureUri = table.Column<string>(nullable: true), |  | ||||||
|                     Price = table.Column<decimal>(nullable: false) |  | ||||||
|                 }, |  | ||||||
|                 constraints: table => |  | ||||||
|                 { |  | ||||||
|                     table.PrimaryKey("PK_Catalog", x => x.Id); |  | ||||||
|                     table.ForeignKey( |  | ||||||
|                         name: "FK_Catalog_CatalogBrand_CatalogBrandId", |  | ||||||
|                         column: x => x.CatalogBrandId, |  | ||||||
|                         principalTable: "CatalogBrand", |  | ||||||
|                         principalColumn: "Id", |  | ||||||
|                         onDelete: ReferentialAction.Cascade); |  | ||||||
|                     table.ForeignKey( |  | ||||||
|                         name: "FK_Catalog_CatalogType_CatalogTypeId", |  | ||||||
|                         column: x => x.CatalogTypeId, |  | ||||||
|                         principalTable: "CatalogType", |  | ||||||
|                         principalColumn: "Id", |  | ||||||
|                         onDelete: ReferentialAction.Cascade); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateIndex( |  | ||||||
|                 name: "IX_Catalog_CatalogBrandId", |  | ||||||
|                 table: "Catalog", |  | ||||||
|                 column: "CatalogBrandId"); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.CreateIndex( |  | ||||||
|                 name: "IX_Catalog_CatalogTypeId", |  | ||||||
|                 table: "Catalog", |  | ||||||
|                 column: "CatalogTypeId"); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         protected override void Down(MigrationBuilder migrationBuilder) |  | ||||||
|         { |  | ||||||
|             migrationBuilder.DropTable( |  | ||||||
|                 name: "Catalog"); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.DropTable( |  | ||||||
|                 name: "CatalogBrand"); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.DropTable( |  | ||||||
|                 name: "CatalogType"); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.DropSequence( |  | ||||||
|                 name: "catalog_brand_hilo"); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.DropSequence( |  | ||||||
|                 name: "catalog_hilo"); |  | ||||||
| 
 |  | ||||||
|             migrationBuilder.DropSequence( |  | ||||||
|                 name: "catalog_type_hilo"); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,95 +0,0 @@ | |||||||
| using Microsoft.EntityFrameworkCore; |  | ||||||
| using Microsoft.EntityFrameworkCore.Infrastructure; |  | ||||||
| using Microsoft.EntityFrameworkCore.Metadata; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Infrastructure.Migrations |  | ||||||
| { |  | ||||||
|     [DbContext(typeof(CatalogContext))] |  | ||||||
|     partial class CatalogContextModelSnapshot : ModelSnapshot |  | ||||||
|     { |  | ||||||
|         protected override void BuildModel(ModelBuilder modelBuilder) |  | ||||||
|         { |  | ||||||
|             modelBuilder |  | ||||||
|                 .HasAnnotation("ProductVersion", "1.1.0-rtm-22752") |  | ||||||
|                 .HasAnnotation("SqlServer:Sequence:.catalog_brand_hilo", "'catalog_brand_hilo', '', '1', '10', '', '', 'Int64', 'False'") |  | ||||||
|                 .HasAnnotation("SqlServer:Sequence:.catalog_hilo", "'catalog_hilo', '', '1', '10', '', '', 'Int64', 'False'") |  | ||||||
|                 .HasAnnotation("SqlServer:Sequence:.catalog_type_hilo", "'catalog_type_hilo', '', '1', '10', '', '', 'Int64', 'False'") |  | ||||||
|                 .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogBrand", b => |  | ||||||
|                 { |  | ||||||
|                     b.Property<int>("Id") |  | ||||||
|                         .ValueGeneratedOnAdd() |  | ||||||
|                         .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_brand_hilo") |  | ||||||
|                         .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Brand") |  | ||||||
|                         .IsRequired() |  | ||||||
|                         .HasMaxLength(100); |  | ||||||
| 
 |  | ||||||
|                     b.HasKey("Id"); |  | ||||||
| 
 |  | ||||||
|                     b.ToTable("CatalogBrand"); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogItem", b => |  | ||||||
|                 { |  | ||||||
|                     b.Property<int>("Id") |  | ||||||
|                         .ValueGeneratedOnAdd() |  | ||||||
|                         .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_hilo") |  | ||||||
|                         .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); |  | ||||||
| 
 |  | ||||||
|                     b.Property<int>("CatalogBrandId"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<int>("CatalogTypeId"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Description"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Name") |  | ||||||
|                         .IsRequired() |  | ||||||
|                         .HasMaxLength(50); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("PictureUri"); |  | ||||||
| 
 |  | ||||||
|                     b.Property<decimal>("Price"); |  | ||||||
| 
 |  | ||||||
|                     b.HasKey("Id"); |  | ||||||
| 
 |  | ||||||
|                     b.HasIndex("CatalogBrandId"); |  | ||||||
| 
 |  | ||||||
|                     b.HasIndex("CatalogTypeId"); |  | ||||||
| 
 |  | ||||||
|                     b.ToTable("Catalog"); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogType", b => |  | ||||||
|                 { |  | ||||||
|                     b.Property<int>("Id") |  | ||||||
|                         .ValueGeneratedOnAdd() |  | ||||||
|                         .HasAnnotation("SqlServer:HiLoSequenceName", "catalog_type_hilo") |  | ||||||
|                         .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.SequenceHiLo); |  | ||||||
| 
 |  | ||||||
|                     b.Property<string>("Type") |  | ||||||
|                         .IsRequired() |  | ||||||
|                         .HasMaxLength(100); |  | ||||||
| 
 |  | ||||||
|                     b.HasKey("Id"); |  | ||||||
| 
 |  | ||||||
|                     b.ToTable("CatalogType"); |  | ||||||
|                 }); |  | ||||||
| 
 |  | ||||||
|             modelBuilder.Entity("eShopWeb.Models.CatalogItem", b => |  | ||||||
|                 { |  | ||||||
|                     b.HasOne("eShopWeb.Models.CatalogBrand", "CatalogBrand") |  | ||||||
|                         .WithMany() |  | ||||||
|                         .HasForeignKey("CatalogBrandId") |  | ||||||
|                         .OnDelete(DeleteBehavior.Cascade); |  | ||||||
| 
 |  | ||||||
|                     b.HasOne("eShopWeb.Models.CatalogType", "CatalogType") |  | ||||||
|                         .WithMany() |  | ||||||
|                         .HasForeignKey("CatalogTypeId") |  | ||||||
|                         .OnDelete(DeleteBehavior.Cascade); |  | ||||||
|                 }); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,15 +0,0 @@ | |||||||
| namespace Microsoft.eShopWeb.Models |  | ||||||
| { |  | ||||||
|     using System; |  | ||||||
|     using System.Collections.Generic; |  | ||||||
|     using System.Linq; |  | ||||||
|     using System.Threading.Tasks; |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     public class CatalogBrand |  | ||||||
|     { |  | ||||||
|         public int Id { get; set; } |  | ||||||
| 
 |  | ||||||
|         public string Brand { get; set; } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,27 +0,0 @@ | |||||||
| using System; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Models |  | ||||||
| { |  | ||||||
|     public class CatalogItem |  | ||||||
|     { |  | ||||||
|         public int Id { get; set; } |  | ||||||
| 
 |  | ||||||
|         public string Name { get; set; } |  | ||||||
| 
 |  | ||||||
|         public string Description { get; set; } |  | ||||||
| 
 |  | ||||||
|         public decimal Price { get; set; } |  | ||||||
| 
 |  | ||||||
|         public string PictureUri { get; set; } |  | ||||||
| 
 |  | ||||||
|         public int CatalogTypeId { get; set; } |  | ||||||
| 
 |  | ||||||
|         public CatalogType CatalogType { get; set; } |  | ||||||
| 
 |  | ||||||
|         public int CatalogBrandId { get; set; } |  | ||||||
| 
 |  | ||||||
|         public CatalogBrand CatalogBrand { get; set; } |  | ||||||
| 
 |  | ||||||
|         public CatalogItem() { } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,14 +0,0 @@ | |||||||
| namespace Microsoft.eShopWeb.Models |  | ||||||
| { |  | ||||||
|     using System; |  | ||||||
|     using System.Collections.Generic; |  | ||||||
|     using System.Linq; |  | ||||||
|     using System.Threading.Tasks; |  | ||||||
| 
 |  | ||||||
|     public class CatalogType |  | ||||||
|     { |  | ||||||
|         public int Id { get; set; } |  | ||||||
| 
 |  | ||||||
|         public string Type { get; set; } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| Before Width: | Height: | Size: 148 KiB | 
| Before Width: | Height: | Size: 223 KiB | 
| Before Width: | Height: | Size: 212 KiB | 
| Before Width: | Height: | Size: 165 KiB | 
| Before Width: | Height: | Size: 41 KiB | 
| Before Width: | Height: | Size: 170 KiB | 
| Before Width: | Height: | Size: 152 KiB | 
| Before Width: | Height: | Size: 226 KiB | 
| Before Width: | Height: | Size: 179 KiB | 
| Before Width: | Height: | Size: 182 KiB | 
| Before Width: | Height: | Size: 167 KiB | 
| Before Width: | Height: | Size: 40 KiB | 
| @ -1,26 +0,0 @@ | |||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.IO; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| using Microsoft.AspNetCore.Hosting; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb |  | ||||||
| { |  | ||||||
|     public class Program |  | ||||||
|     { |  | ||||||
|         public static void Main(string[] args) |  | ||||||
|         { |  | ||||||
|             var host = new WebHostBuilder() |  | ||||||
|                 .UseKestrel() |  | ||||||
|                 .UseUrls("http://0.0.0.0:5106") |  | ||||||
|                 .UseContentRoot(Directory.GetCurrentDirectory()) |  | ||||||
|                 .UseIISIntegration() |  | ||||||
|                 .UseStartup<Startup>() |  | ||||||
|                 .UseApplicationInsights() |  | ||||||
|                 .Build(); |  | ||||||
| 
 |  | ||||||
|             host.Run(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,27 +0,0 @@ | |||||||
| { |  | ||||||
|   "iisSettings": { |  | ||||||
|     "windowsAuthentication": false, |  | ||||||
|     "anonymousAuthentication": true, |  | ||||||
|     "iisExpress": { |  | ||||||
|       "applicationUrl": "http://localhost:5106/", |  | ||||||
|       "sslPort": 0 |  | ||||||
|     } |  | ||||||
|   }, |  | ||||||
|   "profiles": { |  | ||||||
|     "IIS Express": { |  | ||||||
|       "commandName": "IISExpress", |  | ||||||
|       "launchBrowser": true, |  | ||||||
|       "environmentVariables": { |  | ||||||
|         "ASPNETCORE_ENVIRONMENT": "Development" |  | ||||||
|       } |  | ||||||
|     }, |  | ||||||
|     "eShopWeb": { |  | ||||||
|       "commandName": "Project", |  | ||||||
|       "launchBrowser": true, |  | ||||||
|       "environmentVariables": { |  | ||||||
|         "ASPNETCORE_ENVIRONMENT": "Development" |  | ||||||
|       }, |  | ||||||
|       "applicationUrl": "http://localhost:58299" |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,88 +0,0 @@ | |||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| using Microsoft.eShopWeb.Models; |  | ||||||
| using Microsoft.AspNetCore.Mvc.Rendering; |  | ||||||
| using Microsoft.EntityFrameworkCore; |  | ||||||
| using Microsoft.Extensions.Options; |  | ||||||
| using Microsoft.eShopWeb.Infrastructure; |  | ||||||
| using Microsoft.eShopWeb.ViewModels; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Services |  | ||||||
| { |  | ||||||
|     public class CatalogService : ICatalogService |  | ||||||
|     { |  | ||||||
|         private readonly CatalogContext _context; |  | ||||||
|         private readonly IOptionsSnapshot<CatalogSettings> _settings; |  | ||||||
|          |  | ||||||
|         public CatalogService(CatalogContext context, IOptionsSnapshot<CatalogSettings> settings) |  | ||||||
|         { |  | ||||||
|             _context = context; |  | ||||||
|             _settings = settings;             |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async Task<Catalog> GetCatalogItems(int pageIndex, int itemsPage, int? brandId, int? typeId) |  | ||||||
|         { |  | ||||||
|             var root = (IQueryable<CatalogItem>)_context.CatalogItems; |  | ||||||
| 
 |  | ||||||
|             if (typeId.HasValue) |  | ||||||
|             { |  | ||||||
|                 root = root.Where(ci => ci.CatalogTypeId == typeId); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             if (brandId.HasValue) |  | ||||||
|             { |  | ||||||
|                 root = root.Where(ci => ci.CatalogBrandId == brandId); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             var totalItems = await root |  | ||||||
|                 .LongCountAsync(); |  | ||||||
| 
 |  | ||||||
|             var itemsOnPage = await root |  | ||||||
|                 .Skip(itemsPage * pageIndex) |  | ||||||
|                 .Take(itemsPage) |  | ||||||
|                 .ToListAsync(); |  | ||||||
| 
 |  | ||||||
|             itemsOnPage = ComposePicUri(itemsOnPage); |  | ||||||
| 
 |  | ||||||
|             return new Catalog() { Data = itemsOnPage, PageIndex = pageIndex, Count = (int)totalItems };            |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async Task<IEnumerable<SelectListItem>> GetBrands() |  | ||||||
|         { |  | ||||||
|             var brands = await _context.CatalogBrands.ToListAsync(); |  | ||||||
|             var items = new List<SelectListItem>(); |  | ||||||
|             items.Add(new SelectListItem() { Value = null, Text = "All", Selected = true }); |  | ||||||
|             foreach (CatalogBrand brand in brands) |  | ||||||
|             { |  | ||||||
|                 items.Add(new SelectListItem() { Value = brand.Id.ToString(), Text = brand.Brand }); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             return items; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public async Task<IEnumerable<SelectListItem>> GetTypes() |  | ||||||
|         { |  | ||||||
|             var types = await _context.CatalogTypes.ToListAsync(); |  | ||||||
|             var items = new List<SelectListItem>(); |  | ||||||
|             items.Add(new SelectListItem() { Value = null, Text = "All", Selected = true }); |  | ||||||
|             foreach (CatalogType type in types) |  | ||||||
|             { |  | ||||||
|                 items.Add(new SelectListItem() { Value = type.Id.ToString(), Text = type.Type }); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             return items; |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         private List<CatalogItem> ComposePicUri(List<CatalogItem> items) |  | ||||||
|         { |  | ||||||
|             var baseUri = _settings.Value.CatalogBaseUrl;                       |  | ||||||
|             items.ForEach(x => |  | ||||||
|             { |  | ||||||
|                 x.PictureUri = x.PictureUri.Replace("http://catalogbaseurltobereplaced", baseUri); |  | ||||||
|             }); |  | ||||||
| 
 |  | ||||||
|             return items; |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,14 +0,0 @@ | |||||||
| using Microsoft.AspNetCore.Mvc.Rendering; |  | ||||||
| using Microsoft.eShopWeb.ViewModels; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.Services |  | ||||||
| { |  | ||||||
|     public interface ICatalogService |  | ||||||
|     { |  | ||||||
|         Task<Catalog> GetCatalogItems(int pageIndex, int itemsPage, int? brandID, int? typeId); |  | ||||||
|         Task<IEnumerable<SelectListItem>> GetBrands(); |  | ||||||
|         Task<IEnumerable<SelectListItem>> GetTypes(); |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,83 +0,0 @@ | |||||||
| using Microsoft.eShopWeb.Infrastructure; |  | ||||||
| using Microsoft.eShopWeb.Services; |  | ||||||
| using Microsoft.AspNetCore.Builder; |  | ||||||
| using Microsoft.AspNetCore.Hosting; |  | ||||||
| using Microsoft.EntityFrameworkCore; |  | ||||||
| using Microsoft.EntityFrameworkCore.Infrastructure; |  | ||||||
| using Microsoft.Extensions.Configuration; |  | ||||||
| using Microsoft.Extensions.DependencyInjection; |  | ||||||
| using Microsoft.Extensions.Logging; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb |  | ||||||
| { |  | ||||||
|     public class Startup |  | ||||||
|     { |  | ||||||
|         public Startup(IHostingEnvironment env) |  | ||||||
|         { |  | ||||||
|             var builder = new ConfigurationBuilder() |  | ||||||
|                 .SetBasePath(env.ContentRootPath) |  | ||||||
|                 .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) |  | ||||||
|                 .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) |  | ||||||
|                 .AddEnvironmentVariables(); |  | ||||||
|             Configuration = builder.Build(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         public IConfigurationRoot Configuration { get; } |  | ||||||
| 
 |  | ||||||
|         // This method gets called by the runtime. Use this method to add services to the container. |  | ||||||
|         public void ConfigureServices(IServiceCollection services) |  | ||||||
|         { |  | ||||||
|             services.AddDbContext<CatalogContext>(c => |  | ||||||
|             { |  | ||||||
|                 try |  | ||||||
|                 { |  | ||||||
|                     var text = Configuration["ConnectionString"]; |  | ||||||
|                     c.UseSqlServer(Configuration["ConnectionString"]); |  | ||||||
|                     c.ConfigureWarnings(wb => |  | ||||||
|                     { |  | ||||||
|                         //By default, in this application, we don't want to have client evaluations |  | ||||||
|                         wb.Log(RelationalEventId.QueryClientEvaluationWarning); |  | ||||||
|                     }); |  | ||||||
|                 } |  | ||||||
|                 catch (System.Exception ex ) |  | ||||||
|                 { |  | ||||||
|                     var message = ex.Message; |  | ||||||
|                 }                 |  | ||||||
|             }); |  | ||||||
| 
 |  | ||||||
|             services.AddTransient<ICatalogService, CatalogService>(); |  | ||||||
|             services.Configure<CatalogSettings>(Configuration); |  | ||||||
|             services.AddMvc(); |  | ||||||
|         } |  | ||||||
| 
 |  | ||||||
|         // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. |  | ||||||
|         public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) |  | ||||||
|         { |  | ||||||
|             loggerFactory.AddConsole(Configuration.GetSection("Logging")); |  | ||||||
|             loggerFactory.AddDebug(); |  | ||||||
| 
 |  | ||||||
|             if (env.IsDevelopment()) |  | ||||||
|             { |  | ||||||
|                 app.UseDeveloperExceptionPage(); |  | ||||||
|                 app.UseBrowserLink(); |  | ||||||
|             } |  | ||||||
|             else |  | ||||||
|             { |  | ||||||
|                 app.UseExceptionHandler("/Catalog/Error"); |  | ||||||
|             } |  | ||||||
| 
 |  | ||||||
|             app.UseStaticFiles(); |  | ||||||
| 
 |  | ||||||
|             app.UseMvc(routes => |  | ||||||
|             { |  | ||||||
|                 routes.MapRoute( |  | ||||||
|                     name: "default", |  | ||||||
|                     template: "{controller=Catalog}/{action=Index}/{id?}"); |  | ||||||
|             }); |  | ||||||
| 
 |  | ||||||
|             //Seed Data |  | ||||||
|             CatalogContextSeed.SeedAsync(app, loggerFactory) |  | ||||||
|             .Wait(); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,13 +0,0 @@ | |||||||
| using Microsoft.eShopWeb.Models; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.ViewModels |  | ||||||
| { |  | ||||||
|     public class Catalog |  | ||||||
|     { |  | ||||||
|         public int PageIndex { get; set; } |  | ||||||
|         public int PageSize { get; set; } |  | ||||||
|         public int Count { get; set; } |  | ||||||
|         public List<CatalogItem> Data { get; set; } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,16 +0,0 @@ | |||||||
| using Microsoft.eShopWeb.Models; |  | ||||||
| using Microsoft.AspNetCore.Mvc.Rendering; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.ViewModels |  | ||||||
| { |  | ||||||
|     public class CatalogIndex |  | ||||||
|     { |  | ||||||
|         public IEnumerable<CatalogItem> CatalogItems { get; set; } |  | ||||||
|         public IEnumerable<SelectListItem> Brands { get; set; } |  | ||||||
|         public IEnumerable<SelectListItem> Types { get; set; } |  | ||||||
|         public int? BrandFilterApplied { get; set; } |  | ||||||
|         public int? TypesFilterApplied { get; set; } |  | ||||||
|         public PaginationInfo PaginationInfo { get; set; } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,17 +0,0 @@ | |||||||
| using System; |  | ||||||
| using System.Collections.Generic; |  | ||||||
| using System.Linq; |  | ||||||
| using System.Threading.Tasks; |  | ||||||
| 
 |  | ||||||
| namespace Microsoft.eShopWeb.ViewModels |  | ||||||
| { |  | ||||||
|     public class PaginationInfo |  | ||||||
|     { |  | ||||||
|         public int TotalItems { get; set; } |  | ||||||
|         public int ItemsPerPage { get; set; } |  | ||||||
|         public int ActualPage { get; set; } |  | ||||||
|         public int TotalPages { get; set; } |  | ||||||
|         public string Previous { get; set; } |  | ||||||
|         public string Next { get; set; } |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,48 +0,0 @@ | |||||||
| @{ |  | ||||||
|     ViewData["Title"] = "Catalog"; |  | ||||||
|     @model Microsoft.eShopWeb.ViewModels.CatalogIndex |  | ||||||
| } |  | ||||||
| <section class="esh-catalog-hero"> |  | ||||||
|     <div class="container"> |  | ||||||
|         <img class="esh-catalog-title" src="../images/main_banner_text.png" /> |  | ||||||
|     </div> |  | ||||||
| </section> |  | ||||||
| 
 |  | ||||||
| <section class="esh-catalog-filters"> |  | ||||||
|     <div class="container"> |  | ||||||
|         <form asp-action="Index" asp-controller="Catalog" method="post"> |  | ||||||
|             <label class="esh-catalog-label" data-title="brand"> |  | ||||||
|                 <select asp-for="@Model.BrandFilterApplied" asp-items="@Model.Brands" class="esh-catalog-filter"></select> |  | ||||||
|             </label> |  | ||||||
|             <label class="esh-catalog-label" data-title="type"> |  | ||||||
|                 <select asp-for="@Model.TypesFilterApplied" asp-items="@Model.Types" class="esh-catalog-filter"></select> |  | ||||||
|             </label> |  | ||||||
|             <input class="esh-catalog-send" type="image" src="images/arrow-right.svg" /> |  | ||||||
|         </form> |  | ||||||
|     </div> |  | ||||||
| </section> |  | ||||||
| 
 |  | ||||||
| <div class="container"> |  | ||||||
| 
 |  | ||||||
|     @if (Model.CatalogItems.Any()) |  | ||||||
|     { |  | ||||||
|         @Html.Partial("_pagination", Model.PaginationInfo) |  | ||||||
| 
 |  | ||||||
|         <div class="esh-catalog-items row"> |  | ||||||
|             @foreach (var catalogItem in Model.CatalogItems) |  | ||||||
|             { |  | ||||||
|                 <div class="esh-catalog-item col-md-4"> |  | ||||||
|                     @Html.Partial("_product", catalogItem) |  | ||||||
|                 </div> |  | ||||||
|             } |  | ||||||
|         </div> |  | ||||||
| 
 |  | ||||||
|         @Html.Partial("_pagination", Model.PaginationInfo) |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         <div class="esh-catalog-items row"> |  | ||||||
|             THERE ARE NO RESULTS THAT MATCH YOUR SEARCH |  | ||||||
|         </div> |  | ||||||
|     } |  | ||||||
| </div> |  | ||||||
| @ -1,32 +0,0 @@ | |||||||
| @model Microsoft.eShopWeb.ViewModels.PaginationInfo |  | ||||||
| 
 |  | ||||||
| <div class="esh-pager"> |  | ||||||
|     <div class="container"> |  | ||||||
|         <article class="esh-pager-wrapper row"> |  | ||||||
|             <nav> |  | ||||||
|                 <a class="esh-pager-item esh-pager-item--navigable @Model.Previous" |  | ||||||
|                     id="Previous"                     |  | ||||||
|                     asp-controller="Catalog" |  | ||||||
|                     asp-action="Index" |  | ||||||
|                     asp-route-page="@(Model.ActualPage -1)" |  | ||||||
|                     aria-label="Previous"> |  | ||||||
|                     Previous |  | ||||||
|                 </a> |  | ||||||
| 
 |  | ||||||
|                 <span class="esh-pager-item"> |  | ||||||
|                     Showing @Model.ItemsPerPage of @Model.TotalItems products - Page @(Model.ActualPage + 1) - @Model.TotalPages |  | ||||||
|                 </span> |  | ||||||
| 
 |  | ||||||
|                 <a class="esh-pager-item esh-pager-item--navigable @Model.Next" |  | ||||||
|                     id="Next"                     |  | ||||||
|                     asp-controller="Catalog" |  | ||||||
|                     asp-action="Index" |  | ||||||
|                     asp-route-page="@(Model.ActualPage + 1)" |  | ||||||
|                     aria-label="Next"> |  | ||||||
|                     Next |  | ||||||
|                 </a> |  | ||||||
|             </nav> |  | ||||||
|         </article> |  | ||||||
|     </div> |  | ||||||
| </div> |  | ||||||
| 
 |  | ||||||
| @ -1,24 +0,0 @@ | |||||||
| @model Microsoft.eShopWeb.Models.CatalogItem |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| <form asp-controller="Cart" asp-action="AddToCart"> |  | ||||||
| 
 |  | ||||||
|     <img class="esh-catalog-thumbnail" src="@Model.PictureUri" /> |  | ||||||
|     <input class="esh-catalog-button @((!User.Identity.IsAuthenticated) ? "is-disabled" : "")" type="submit" value="[ ADD TO CART ]" /> |  | ||||||
| 
 |  | ||||||
|     <div class="esh-catalog-name"> |  | ||||||
|         <span>@Model.Name</span> |  | ||||||
|     </div> |  | ||||||
|     <div class="esh-catalog-price"> |  | ||||||
|         <span>@Model.Price.ToString("N2")</span> |  | ||||||
|     </div> |  | ||||||
|     <input type="hidden" asp-for="@Model.CatalogBrand" name="brand" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.CatalogBrandId" name="brandId" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.CatalogType" name="type" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.CatalogTypeId" name="typeId" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.Description" name="description" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.Id" name="id" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.Name" name="name" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.PictureUri" name="pictureUri" /> |  | ||||||
|     <input type="hidden" asp-for="@Model.Price" name="price" /> |  | ||||||
| </form> |  | ||||||
| @ -1,14 +0,0 @@ | |||||||
| @{ |  | ||||||
|     ViewData["Title"] = "Error"; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| <h1 class="text-danger">Error.</h1> |  | ||||||
| <h2 class="text-danger">An error occurred while processing your request.</h2> |  | ||||||
| 
 |  | ||||||
| <h3>Development Mode</h3> |  | ||||||
| <p> |  | ||||||
|     Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred. |  | ||||||
| </p> |  | ||||||
| <p> |  | ||||||
|     <strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application. |  | ||||||
| </p> |  | ||||||
| @ -1,75 +0,0 @@ | |||||||
| <!DOCTYPE html> |  | ||||||
| <html> |  | ||||||
| <head> |  | ||||||
|     <meta charset="utf-8" /> |  | ||||||
|     <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |  | ||||||
|     <title>@ViewData["Title"] - Microsoft.eShopOnContainers.WebMVC</title> |  | ||||||
| 
 |  | ||||||
|     <environment names="Development"> |  | ||||||
|         <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" /> |  | ||||||
|         <link rel="stylesheet" href="~/css/app.css" />         |  | ||||||
|         <link rel="stylesheet" href="~/css/catalog/pager.css" />         |  | ||||||
|         <link rel="stylesheet" href="~/css/catalog/catalog.component.css" />         |  | ||||||
|     </environment> |  | ||||||
|     <environment names="Staging,Production"> |  | ||||||
|         <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" |  | ||||||
|               asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css" |  | ||||||
|               asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" /> |  | ||||||
|         <link rel="stylesheet" href="~/css/app.min.css" asp-append-version="true" /> |  | ||||||
|     </environment> |  | ||||||
| </head> |  | ||||||
| <body> |  | ||||||
|     <header class="navbar navbar-light navbar-static-top"> |  | ||||||
|         <div class="container"> |  | ||||||
|             <article class="row"> |  | ||||||
| 
 |  | ||||||
|                 <section class="col-lg-7 col-md-6 col-xs-12"> |  | ||||||
|                     <a class="navbar-brand" routerLink="catalog"> |  | ||||||
|                         <a asp-area="" asp-controller="Catalog" asp-action="Index"> |  | ||||||
|                             <img src="../images/brand.png" /> |  | ||||||
|                         </a> |  | ||||||
|                 </section> |  | ||||||
|            |  | ||||||
|             </article> |  | ||||||
|         </div> |  | ||||||
|     </header> |  | ||||||
| 
 |  | ||||||
|     @RenderBody() |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     <footer class="esh-app-footer"> |  | ||||||
|         <div class="container"> |  | ||||||
|             <article class="row"> |  | ||||||
| 
 |  | ||||||
|                 <section class="col-sm-6"> |  | ||||||
|                     <img class="esh-app-footer-brand" src="../images/brand_dark.png" /> |  | ||||||
|                 </section> |  | ||||||
| 
 |  | ||||||
|                 <section class="col-sm-6"> |  | ||||||
|                     <div class="esh-app-footer-text hidden-xs"> e-ShoponContainers. All right reserved </div> |  | ||||||
|                 </section> |  | ||||||
| 
 |  | ||||||
|             </article> |  | ||||||
|         </div> |  | ||||||
|     </footer> |  | ||||||
| 
 |  | ||||||
|     <environment names="Development"> |  | ||||||
|         <script src="~/lib/jquery/dist/jquery.js"></script> |  | ||||||
|         <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script> |  | ||||||
|         <script src="~/js/site.js" asp-append-version="true"></script> |  | ||||||
|     </environment> |  | ||||||
|     <environment names="Staging,Production"> |  | ||||||
|         <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js" |  | ||||||
|                 asp-fallback-src="~/lib/jquery/dist/jquery.min.js" |  | ||||||
|                 asp-fallback-test="window.jQuery"> |  | ||||||
|         </script> |  | ||||||
|         <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.6/bootstrap.min.js" |  | ||||||
|                 asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js" |  | ||||||
|                 asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"> |  | ||||||
|         </script> |  | ||||||
|         <script src="~/js/site.min.js" asp-append-version="true"></script> |  | ||||||
|     </environment> |  | ||||||
| 
 |  | ||||||
|     @RenderSection("scripts", required: false) |  | ||||||
| </body> |  | ||||||
| </html> |  | ||||||
| @ -1,18 +0,0 @@ | |||||||
| <environment names="Development"> |  | ||||||
|     <script src="~/lib/jquery-validation/dist/jquery.validate.js"></script> |  | ||||||
|     <script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script> |  | ||||||
| </environment> |  | ||||||
| <environment names="Staging,Production"> |  | ||||||
|     <script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js" |  | ||||||
|             asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js" |  | ||||||
|             asp-fallback-test="window.jQuery && window.jQuery.validator" |  | ||||||
|             crossorigin="anonymous" |  | ||||||
|             integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k"> |  | ||||||
|     </script> |  | ||||||
|     <script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js" |  | ||||||
|             asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" |  | ||||||
|             asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive" |  | ||||||
|             crossorigin="anonymous" |  | ||||||
|             integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH"> |  | ||||||
|     </script> |  | ||||||
| </environment> |  | ||||||
| @ -1,2 +0,0 @@ | |||||||
| @using Microsoft.eShopWeb |  | ||||||
| @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers |  | ||||||
| @ -1,3 +0,0 @@ | |||||||
| @{ |  | ||||||
|     Layout = "_Layout"; |  | ||||||
| } |  | ||||||
| @ -1,10 +0,0 @@ | |||||||
| { |  | ||||||
|   "Logging": { |  | ||||||
|     "IncludeScopes": false, |  | ||||||
|     "LogLevel": { |  | ||||||
|       "Default": "Debug", |  | ||||||
|       "System": "Information", |  | ||||||
|       "Microsoft": "Information" |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,10 +0,0 @@ | |||||||
| { |  | ||||||
|   "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word", |  | ||||||
|   "CatalogBaseUrl": "http://localhost:5106", |  | ||||||
|   "Logging": { |  | ||||||
|     "IncludeScopes": false, |  | ||||||
|     "LogLevel": { |  | ||||||
|       "Default": "Warning" |  | ||||||
|     } |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,10 +0,0 @@ | |||||||
| { |  | ||||||
|   "name": "asp.net", |  | ||||||
|   "private": true, |  | ||||||
|   "dependencies": { |  | ||||||
|     "bootstrap": "3.3.7", |  | ||||||
|     "jquery": "2.2.0", |  | ||||||
|     "jquery-validation": "1.14.0", |  | ||||||
|     "jquery-validation-unobtrusive": "3.2.6" |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,24 +0,0 @@ | |||||||
| // Configure bundling and minification for the project. |  | ||||||
| // More info at https://go.microsoft.com/fwlink/?LinkId=808241 |  | ||||||
| [ |  | ||||||
|   { |  | ||||||
|     "outputFileName": "wwwroot/css/site.min.css", |  | ||||||
|     // An array of relative input file paths. Globbing patterns supported |  | ||||||
|     "inputFiles": [ |  | ||||||
|       "wwwroot/css/site.css" |  | ||||||
|     ] |  | ||||||
|   }, |  | ||||||
|   { |  | ||||||
|     "outputFileName": "wwwroot/js/site.min.js", |  | ||||||
|     "inputFiles": [ |  | ||||||
|       "wwwroot/js/site.js" |  | ||||||
|     ], |  | ||||||
|     // Optionally specify minification options |  | ||||||
|     "minify": { |  | ||||||
|       "enabled": true, |  | ||||||
|       "renameLocals": true |  | ||||||
|     }, |  | ||||||
|     // Optionally generate .map file |  | ||||||
|     "sourceMap": false |  | ||||||
|   } |  | ||||||
| ] |  | ||||||
| @ -1,37 +0,0 @@ | |||||||
| <Project Sdk="Microsoft.NET.Sdk.Web"> |  | ||||||
| 
 |  | ||||||
|   <PropertyGroup> |  | ||||||
|     <TargetFramework>netcoreapp1.1</TargetFramework> |  | ||||||
|   </PropertyGroup> |  | ||||||
| 
 |  | ||||||
|   <PropertyGroup> |  | ||||||
|     <PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback> |  | ||||||
|     <RuntimeFrameworkVersion>1.1.0</RuntimeFrameworkVersion> |  | ||||||
|     <DockerComposeProjectPath>..\docker-compose.dcproj</DockerComposeProjectPath> |  | ||||||
|   </PropertyGroup> |  | ||||||
| 
 |  | ||||||
|   <ItemGroup> |  | ||||||
|     <PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.AspNetCore" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" /> |  | ||||||
|     <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" /> |  | ||||||
|     <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild3-final" /> |  | ||||||
|   </ItemGroup> |  | ||||||
|   <ItemGroup> |  | ||||||
|     <Folder Include="Models\" /> |  | ||||||
|     <Folder Include="Pics\" /> |  | ||||||
|     <Folder Include="Views\Catalog\" /> |  | ||||||
|     <Folder Include="wwwroot\css\catalog\" /> |  | ||||||
|     <Folder Include="wwwroot\fonts\" /> |  | ||||||
|   </ItemGroup> |  | ||||||
| 
 |  | ||||||
| </Project> |  | ||||||
| @ -1,86 +0,0 @@ | |||||||
| @font-face { |  | ||||||
|     font-family: Montserrat; |  | ||||||
|     font-weight: 400; |  | ||||||
|     src: url(".../fonts/Montserrat-Regular.eot?") format("eot"), url("../fonts/Montserrat-Regular.woff") format("woff"), url("../fonts/Montserrat-Regular.ttf") format("truetype"), url("../fonts/Montserrat-Regular.svg#Montserrat") format("svg"); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @font-face { |  | ||||||
|     font-family: Montserrat; |  | ||||||
|     font-weight: 700; |  | ||||||
|     src: url("../fonts/Montserrat-Bold.eot?") format("eot"), url("../fonts/Montserrat-Bold.woff") format("woff"), url("../fonts/Montserrat-Bold.ttf") format("truetype"), url("../fonts/Montserrat-Bold.svg#Montserrat") format("svg"); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| html, |  | ||||||
| body { |  | ||||||
|     font-family: Montserrat, sans-serif; |  | ||||||
|     font-size: 16px; |  | ||||||
|     font-weight: 400; |  | ||||||
|     z-index: 10; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| *, |  | ||||||
| *::after, |  | ||||||
| *::before { |  | ||||||
|     box-sizing: border-box; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .preloading { |  | ||||||
|     color: #00A69C; |  | ||||||
|     display: block; |  | ||||||
|     font-size: 1.5rem; |  | ||||||
|     left: 50%; |  | ||||||
|     position: fixed; |  | ||||||
|     top: 50%; |  | ||||||
|     transform: translate(-50%, -50%); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| select::-ms-expand { |  | ||||||
|     display: none; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @media screen and (min-width: 992px) { |  | ||||||
|     .form-input { |  | ||||||
|         max-width: 360px; |  | ||||||
|         width: 360px; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .form-input { |  | ||||||
|     border-radius: 0; |  | ||||||
|     height: 45px; |  | ||||||
|     padding: 10px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .form-input-small { |  | ||||||
|     max-width: 100px !important; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .form-input-medium { |  | ||||||
|     width: 150px !important; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .alert { |  | ||||||
|     padding-left: 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .alert-danger { |  | ||||||
|     background-color: transparent; |  | ||||||
|     border: 0; |  | ||||||
|     color: #FB0D0D; |  | ||||||
|     font-size: 12px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| a, |  | ||||||
| a:active, |  | ||||||
| a:hover, |  | ||||||
| a:visited { |  | ||||||
|     color: #000; |  | ||||||
|     text-decoration: none; |  | ||||||
|     transition: color 0.35s; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|     a:hover, |  | ||||||
|     a:active { |  | ||||||
|         color: #75B918; |  | ||||||
|         transition: color 0.35s; |  | ||||||
|     } |  | ||||||
| @ -1,147 +0,0 @@ | |||||||
| .esh-catalog-hero { |  | ||||||
|     background-image: url("../../images/main_banner.png"); |  | ||||||
|     background-size: cover; |  | ||||||
|     height: 260px; |  | ||||||
|     width: 100%; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-title { |  | ||||||
|     position: relative; |  | ||||||
|     top: 74.28571px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-filters { |  | ||||||
|     background-color: #00A69C; |  | ||||||
|     height: 65px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-filter { |  | ||||||
|     background-color: transparent; |  | ||||||
|     border-color: #00d9cc; |  | ||||||
|     color: #FFFFFF; |  | ||||||
|     cursor: pointer; |  | ||||||
|     margin-right: 1rem; |  | ||||||
|     margin-top: .5rem; |  | ||||||
|     outline-color: #83D01B; |  | ||||||
|     padding-bottom: 0; |  | ||||||
|     padding-left: 0.5rem; |  | ||||||
|     padding-right: 0.5rem; |  | ||||||
|     padding-top: 1.5rem; |  | ||||||
|     min-width: 140px; |  | ||||||
|     -webkit-appearance: none; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|     .esh-catalog-filter option { |  | ||||||
|         background-color: #00A69C; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-label { |  | ||||||
|     display: inline-block; |  | ||||||
|     position: relative; |  | ||||||
|     z-index: 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|     .esh-catalog-label::before { |  | ||||||
|         color: rgba(255, 255, 255, 0.5); |  | ||||||
|         content: attr(data-title); |  | ||||||
|         font-size: 0.65rem; |  | ||||||
|         margin-top: 0.65rem; |  | ||||||
|         margin-left: 0.5rem; |  | ||||||
|         position: absolute; |  | ||||||
|         text-transform: uppercase; |  | ||||||
|         z-index: 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     .esh-catalog-label::after { |  | ||||||
|         background-image: url("../../images/arrow-down.png"); |  | ||||||
|         height: 7px; |  | ||||||
|         content: ''; |  | ||||||
|         position: absolute; |  | ||||||
|         right: 1.5rem; |  | ||||||
|         top: 2.5rem; |  | ||||||
|         width: 10px; |  | ||||||
|         z-index: 1; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-send { |  | ||||||
|     background-color: #83D01B; |  | ||||||
|     color: #FFFFFF; |  | ||||||
|     cursor: pointer; |  | ||||||
|     font-size: 1rem; |  | ||||||
|     transform: translateY(.5rem); |  | ||||||
|     padding: 0.5rem; |  | ||||||
|     transition: all 0.35s; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|     .esh-catalog-send:hover { |  | ||||||
|         background-color: #4a760f; |  | ||||||
|         transition: all 0.35s; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-items { |  | ||||||
|     margin-top: 1rem; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-item { |  | ||||||
|     text-align: center; |  | ||||||
|     margin-bottom: 1.5rem; |  | ||||||
|     width: 33%; |  | ||||||
|     display: inline-block; |  | ||||||
|     float: none !important; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @media screen and (max-width: 1024px) { |  | ||||||
|     .esh-catalog-item { |  | ||||||
|         width: 50%; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @media screen and (max-width: 768px) { |  | ||||||
|     .esh-catalog-item { |  | ||||||
|         width: 100%; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-thumbnail { |  | ||||||
|     max-width: 370px; |  | ||||||
|     width: 100%; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-button { |  | ||||||
|     background-color: #83D01B; |  | ||||||
|     border: none; |  | ||||||
|     color: #FFFFFF; |  | ||||||
|     cursor: pointer; |  | ||||||
|     font-size: 1rem; |  | ||||||
|     height: 3rem; |  | ||||||
|     margin-top: 1rem; |  | ||||||
|     transition: all 0.35s; |  | ||||||
|     width: 80%; |  | ||||||
| } |  | ||||||
|     .esh-catalog-button.is-disabled { |  | ||||||
|         opacity: .5; |  | ||||||
|         pointer-events: none; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     .esh-catalog-button:hover { |  | ||||||
|         background-color: #4a760f; |  | ||||||
|         transition: all 0.35s; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-name { |  | ||||||
|     font-size: 1rem; |  | ||||||
|     font-weight: 300; |  | ||||||
|     margin-top: .5rem; |  | ||||||
|     text-align: center; |  | ||||||
|     text-transform: uppercase; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-catalog-price { |  | ||||||
|     text-align: center; |  | ||||||
|     font-weight: 900; |  | ||||||
|     font-size: 28px; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|     .esh-catalog-price::before { |  | ||||||
|         content: '$'; |  | ||||||
|     } |  | ||||||
| @ -1,34 +0,0 @@ | |||||||
| .esh-pager-wrapper { |  | ||||||
|     padding-top: 1rem; |  | ||||||
|     text-align: center; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-pager-item { |  | ||||||
|     margin: 0 5vw; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| .esh-pager-item--navigable { |  | ||||||
|     display: inline-block; |  | ||||||
|     cursor: pointer; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
|     .esh-pager-item--navigable.is-disabled { |  | ||||||
|         opacity: 0; |  | ||||||
|         pointer-events: none; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     .esh-pager-item--navigable:hover { |  | ||||||
|         color: #83D01B; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
| @media screen and (max-width: 1280px) { |  | ||||||
|     .esh-pager-item { |  | ||||||
|         font-size: 0.85rem; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @media screen and (max-width: 1024px) { |  | ||||||
|     .esh-pager-item { |  | ||||||
|         margin: 0 4vw; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| Before Width: | Height: | Size: 31 KiB |