diff --git a/src/Tests/Services/Application.FunctionalTests/Services/Catalog/CatalogScenariosBase.cs b/src/Tests/Services/Application.FunctionalTests/Services/Catalog/CatalogScenariosBase.cs index 96d625b72..c5d9ab72d 100644 --- a/src/Tests/Services/Application.FunctionalTests/Services/Catalog/CatalogScenariosBase.cs +++ b/src/Tests/Services/Application.FunctionalTests/Services/Catalog/CatalogScenariosBase.cs @@ -27,7 +27,7 @@ namespace FunctionalTests.Services.Catalog .AddEnvironmentVariables(); }).UseStartup(); - var testServer = new TestServer(hostBuilder); + var testServer = new TestServer(hostBuilder); testServer.Host .MigrateDbContext((context, services) => diff --git a/src/Tests/Services/Application.FunctionalTests/Services/IntegrationEventsScenarios.cs b/src/Tests/Services/Application.FunctionalTests/Services/IntegrationEventsScenarios.cs index ff06ad78f..a8bdcd122 100644 --- a/src/Tests/Services/Application.FunctionalTests/Services/IntegrationEventsScenarios.cs +++ b/src/Tests/Services/Application.FunctionalTests/Services/IntegrationEventsScenarios.cs @@ -43,8 +43,8 @@ namespace FunctionalTests.Services var oldPrice = itemToModify.UnitPrice; var newPrice = oldPrice + priceModification; var pRes = await catalogClient.PutAsync(CatalogScenariosBase.Put.UpdateCatalogProduct, new StringContent(ChangePrice(itemToModify, newPrice, originalCatalogProducts), UTF8Encoding.UTF8, "application/json")); - - var modifiedCatalogProducts = await GetCatalogAsync(catalogClient); + + var modifiedCatalogProducts = await GetCatalogAsync(catalogClient); var itemUpdated = await GetUpdatedBasketItem(newPrice, itemToModify.ProductId, userId, basketClient); @@ -71,7 +71,7 @@ namespace FunctionalTests.Services BasketItem itemUpdated = null; while (continueLoop && counter < 20) - { + { //get the basket and verify that the price of the modified product is updated var basketGetResponse = await basketClient.GetAsync(BasketScenariosBase.Get.GetBasketByCustomer(userId)); var basketUpdated = JsonConvert.DeserializeObject(await basketGetResponse.Content.ReadAsStringAsync()); @@ -92,7 +92,7 @@ namespace FunctionalTests.Services return itemUpdated; } - private async Task> GetCatalogAsync(HttpClient catalogClient) + private async Task> GetCatalogAsync(HttpClient catalogClient) { var response = await catalogClient.GetAsync(CatalogScenariosBase.Get.Items); var items = await response.Content.ReadAsStringAsync(); diff --git a/src/Tests/Services/Application.FunctionalTests/Services/Marketing/UserLocationRoleScenariosBase.cs b/src/Tests/Services/Application.FunctionalTests/Services/Marketing/UserLocationRoleScenariosBase.cs index 20beeef48..3949d5f87 100644 --- a/src/Tests/Services/Application.FunctionalTests/Services/Marketing/UserLocationRoleScenariosBase.cs +++ b/src/Tests/Services/Application.FunctionalTests/Services/Marketing/UserLocationRoleScenariosBase.cs @@ -15,7 +15,7 @@ public static class Post { - public static string AddNewuserLocationRule(int campaignId) + public static string AddNewuserLocationRule(int campaignId) => GetUserLocationRolesUrlBase(campaignId); } diff --git a/src/Tests/Services/Application.FunctionalTests/Services/Ordering/OrderingScenarios.cs b/src/Tests/Services/Application.FunctionalTests/Services/Ordering/OrderingScenarios.cs index cb1fc2526..3a6e1c04b 100644 --- a/src/Tests/Services/Application.FunctionalTests/Services/Ordering/OrderingScenarios.cs +++ b/src/Tests/Services/Application.FunctionalTests/Services/Ordering/OrderingScenarios.cs @@ -15,7 +15,7 @@ using Xunit; namespace FunctionalTests.Services.Ordering { public class OrderingScenarios : OrderingScenariosBase - { + { [Fact] public async Task Cancel_basket_and_check_order_status_cancelled() { @@ -69,7 +69,8 @@ namespace FunctionalTests.Services.Ordering var ordersGetResponse = await orderClient.GetStringAsync(OrderingScenariosBase.Get.Orders); var orders = JsonConvert.DeserializeObject>(ordersGetResponse); - if (orders == null || orders.Count == 0) { + if (orders == null || orders.Count == 0) + { counter++; await Task.Delay(100); continue; @@ -84,9 +85,9 @@ namespace FunctionalTests.Services.Ordering if (IsOrderCreated(order, city)) { break; - } - } - + } + } + return order; } @@ -117,7 +118,7 @@ namespace FunctionalTests.Services.Ordering var order = new OrderDTO() { OrderNumber = orderId - }; + }; return JsonConvert.SerializeObject(order); } @@ -135,7 +136,7 @@ namespace FunctionalTests.Services.Ordering CardExpiration = DateTime.Now.AddYears(1), CardSecurityNumber = "123", CardTypeId = 1, - Buyer = "Buyer", + Buyer = "Buyer", RequestId = Guid.NewGuid() }; @@ -143,4 +144,3 @@ namespace FunctionalTests.Services.Ordering } } } - \ No newline at end of file diff --git a/src/Web/WebMVC/AppSettings.cs b/src/Web/WebMVC/AppSettings.cs index a705c5a90..dacb92adc 100644 --- a/src/Web/WebMVC/AppSettings.cs +++ b/src/Web/WebMVC/AppSettings.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.WebMVC +namespace Microsoft.eShopOnContainers.WebMVC { public class AppSettings { diff --git a/src/Web/WebMVC/Controllers/CampaignsController.cs b/src/Web/WebMVC/Controllers/CampaignsController.cs index 920269467..ff98850db 100644 --- a/src/Web/WebMVC/Controllers/CampaignsController.cs +++ b/src/Web/WebMVC/Controllers/CampaignsController.cs @@ -2,16 +2,16 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { using AspNetCore.Authorization; using AspNetCore.Mvc; - using global::WebMVC.Services.ModelDTOs; using global::WebMVC.Services; + using global::WebMVC.Services.ModelDTOs; using global::WebMVC.ViewModels; + using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Microsoft.Extensions.Options; using Services; using System; using System.Threading.Tasks; using ViewModels; using ViewModels.Pagination; - using Microsoft.AspNetCore.Authentication.OpenIdConnect; [Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)] public class CampaignsController : Controller @@ -31,12 +31,12 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { var campaignList = await _campaignService.GetCampaigns(pageSize, page); - if(campaignList is null) + if (campaignList is null) { return View(); } - var totalPages = (int) Math.Ceiling((decimal) campaignList.Count / pageSize); + var totalPages = (int)Math.Ceiling((decimal)campaignList.Count / pageSize); var vm = new CampaignViewModel { diff --git a/src/Web/WebMVC/Controllers/CatalogController.cs b/src/Web/WebMVC/Controllers/CatalogController.cs index 9e0859858..0ac5ecacc 100644 --- a/src/Web/WebMVC/Controllers/CatalogController.cs +++ b/src/Web/WebMVC/Controllers/CatalogController.cs @@ -1,10 +1,9 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination; +using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels; -using Microsoft.AspNetCore.Http; +using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination; +using System; +using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.Controllers { @@ -12,10 +11,10 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { private ICatalogService _catalogSvc; - public CatalogController(ICatalogService catalogSvc) => + public CatalogController(ICatalogService catalogSvc) => _catalogSvc = catalogSvc; - public async Task Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page, [FromQuery]string errorMsg) + public async Task Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page, [FromQuery] string errorMsg) { var itemsPage = 10; var catalog = await _catalogSvc.GetCatalogItems(page ?? 0, itemsPage, BrandFilterApplied, TypesFilterApplied); @@ -30,7 +29,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers { ActualPage = page ?? 0, ItemsPerPage = catalog.Data.Count, - TotalItems = catalog.Count, + TotalItems = catalog.Count, TotalPages = (int)Math.Ceiling(((decimal)catalog.Count / itemsPage)) } }; diff --git a/src/Web/WebMVC/Controllers/OrderManagementController.cs b/src/Web/WebMVC/Controllers/OrderManagementController.cs index 6963c469d..27ad642ba 100644 --- a/src/Web/WebMVC/Controllers/OrderManagementController.cs +++ b/src/Web/WebMVC/Controllers/OrderManagementController.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using Microsoft.AspNetCore.Authentication.OpenIdConnect; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using WebMVC.Services.ModelDTOs; using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Authentication.OpenIdConnect; +using System.Threading.Tasks; +using WebMVC.Services.ModelDTOs; namespace WebMVC.Controllers { @@ -37,7 +34,7 @@ namespace WebMVC.Controllers { await _orderSvc.ShipOrder(orderId); } - + return RedirectToAction("Index"); } } diff --git a/src/Web/WebMVC/Controllers/TestController.cs b/src/Web/WebMVC/Controllers/TestController.cs index 2cf053126..a80fe9ad8 100644 --- a/src/Web/WebMVC/Controllers/TestController.cs +++ b/src/Web/WebMVC/Controllers/TestController.cs @@ -48,7 +48,7 @@ namespace WebMVC.Controllers if (response.IsSuccessStatusCode) { - var str = await response.Content.ReadAsStringAsync(); + var str = await response.Content.ReadAsStringAsync(); return Ok(str); } diff --git a/src/Web/WebMVC/Extensions/HttpClientExtensions.cs b/src/Web/WebMVC/Extensions/HttpClientExtensions.cs index a1d6f215d..087c0dd8a 100644 --- a/src/Web/WebMVC/Extensions/HttpClientExtensions.cs +++ b/src/Web/WebMVC/Extensions/HttpClientExtensions.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; -using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Text; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.Extensions { diff --git a/src/Web/WebMVC/Extensions/SessionExtensions.cs b/src/Web/WebMVC/Extensions/SessionExtensions.cs index 79bd435f0..47b079158 100644 --- a/src/Web/WebMVC/Extensions/SessionExtensions.cs +++ b/src/Web/WebMVC/Extensions/SessionExtensions.cs @@ -1,9 +1,5 @@ using Microsoft.AspNetCore.Http; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; public static class SessionExtensions diff --git a/src/Web/WebMVC/Infrastructure/HttpClientRequestIdDelegatingHandler.cs b/src/Web/WebMVC/Infrastructure/HttpClientRequestIdDelegatingHandler.cs index 37bea4d30..a59c757c0 100644 --- a/src/Web/WebMVC/Infrastructure/HttpClientRequestIdDelegatingHandler.cs +++ b/src/Web/WebMVC/Infrastructure/HttpClientRequestIdDelegatingHandler.cs @@ -22,7 +22,7 @@ namespace WebMVC.Infrastructure request.Headers.Add("x-requestid", Guid.NewGuid().ToString()); } } - + return await base.SendAsync(request, cancellationToken); } } diff --git a/src/Web/WebMVC/Infrastructure/Middlewares/ByPassAuthMiddleware.cs b/src/Web/WebMVC/Infrastructure/Middlewares/ByPassAuthMiddleware.cs index 4661aa13c..dd56c28e2 100644 --- a/src/Web/WebMVC/Infrastructure/Middlewares/ByPassAuthMiddleware.cs +++ b/src/Web/WebMVC/Infrastructure/Middlewares/ByPassAuthMiddleware.cs @@ -1,7 +1,6 @@ using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Primitives; using System; -using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Threading.Tasks; @@ -63,7 +62,7 @@ namespace WebMVC.Infrastructure.Middlewares new Claim("name", "Test user"), new Claim("nonce", Guid.NewGuid().ToString()), new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name", "Test user"), - new Claim("http://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), + new Claim("http://schemas.microsoft.com/identity/claims/identityprovider", "ByPassAuthMiddleware"), new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname","User"), new Claim("sub", currentUserId), new Claim("card_expiration", "12/21"), diff --git a/src/Web/WebMVC/Infrastructure/WebContextSeed.cs b/src/Web/WebMVC/Infrastructure/WebContextSeed.cs index ab3b8d801..16696af9d 100644 --- a/src/Web/WebMVC/Infrastructure/WebContextSeed.cs +++ b/src/Web/WebMVC/Infrastructure/WebContextSeed.cs @@ -35,7 +35,7 @@ namespace WebMVC.Infrastructure static void GetPreconfiguredCSS(string contentRootPath, string webroot, ILogger log) { try - { + { string overrideCssFile = Path.Combine(contentRootPath, "Setup", "override.css"); if (!File.Exists(overrideCssFile)) { @@ -44,7 +44,7 @@ namespace WebMVC.Infrastructure } string destinationFilename = Path.Combine(webroot, "css", "override.css"); - File.Copy(overrideCssFile, destinationFilename, true ); + File.Copy(overrideCssFile, destinationFilename, true); } catch (Exception ex) { @@ -86,7 +86,7 @@ namespace WebMVC.Infrastructure } } } - catch ( Exception ex ) + catch (Exception ex) { log.Error(ex, "EXCEPTION ERROR: {Message}", ex.Message); } diff --git a/src/Web/WebMVC/Program.cs b/src/Web/WebMVC/Program.cs index eb99cd42e..36292dca8 100644 --- a/src/Web/WebMVC/Program.cs +++ b/src/Web/WebMVC/Program.cs @@ -42,13 +42,13 @@ namespace Microsoft.eShopOnContainers.WebMVC private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) => WebHost.CreateDefaultBuilder(args) - .CaptureStartupErrors(false) + .CaptureStartupErrors(false) .ConfigureAppConfiguration(x => x.AddConfiguration(configuration)) .UseStartup() .UseSerilog() .Build(); - private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration) + private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration) { var seqServerUrl = configuration["Serilog:SeqServerUrl"]; var logstashUrl = configuration["Serilog:LogstashgUrl"]; @@ -57,10 +57,12 @@ namespace Microsoft.eShopOnContainers.WebMVC .Enrich.WithProperty("ApplicationContext", AppName) .Enrich.FromLogContext() .WriteTo.Console(); - if (!string.IsNullOrWhiteSpace(seqServerUrl)) { + if (!string.IsNullOrWhiteSpace(seqServerUrl)) + { cfg.WriteTo.Seq(seqServerUrl); } - if (!string.IsNullOrWhiteSpace(logstashUrl)) { + if (!string.IsNullOrWhiteSpace(logstashUrl)) + { cfg.WriteTo.Http(logstashUrl); } return cfg.CreateLogger(); diff --git a/src/Web/WebMVC/Services/BasketService.cs b/src/Web/WebMVC/Services/BasketService.cs index 64184f7b2..26985a671 100644 --- a/src/Web/WebMVC/Services/BasketService.cs +++ b/src/Web/WebMVC/Services/BasketService.cs @@ -23,7 +23,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services { _apiClient = httpClient; _settings = settings; - _logger =logger; + _logger = logger; _basketByPassUrl = $"{_settings.Value.PurchaseUrl}/b/api/v1/basket"; _purchaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1"; @@ -33,7 +33,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services { var uri = API.Basket.GetBasket(_basketByPassUrl, user.Id); _logger.LogDebug("[GetBasket] -> Calling {Uri} to get the basket", uri); - var response = await _apiClient.GetAsync(uri); + var response = await _apiClient.GetAsync(uri); _logger.LogDebug("[GetBasket] -> response code {StatusCode}", response.StatusCode); var responseString = await response.Content.ReadAsStringAsync(); return string.IsNullOrEmpty(responseString) ? @@ -97,7 +97,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services var responseString = await _apiClient.GetStringAsync(uri); - var response = JsonConvert.DeserializeObject(responseString); + var response = JsonConvert.DeserializeObject(responseString); return response; } diff --git a/src/Web/WebMVC/Services/IBasketService.cs b/src/Web/WebMVC/Services/IBasketService.cs index 8c096bfaf..cc576ec11 100644 --- a/src/Web/WebMVC/Services/IBasketService.cs +++ b/src/Web/WebMVC/Services/IBasketService.cs @@ -1,7 +1,5 @@ using Microsoft.eShopOnContainers.WebMVC.ViewModels; -using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using WebMVC.Services.ModelDTOs; diff --git a/src/Web/WebMVC/Services/ICampaignService.cs b/src/Web/WebMVC/Services/ICampaignService.cs index ab80e930a..c12a3ae01 100644 --- a/src/Web/WebMVC/Services/ICampaignService.cs +++ b/src/Web/WebMVC/Services/ICampaignService.cs @@ -1,6 +1,5 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services { - using System.Collections.Generic; using System.Threading.Tasks; using ViewModels; diff --git a/src/Web/WebMVC/Services/ICatalogService.cs b/src/Web/WebMVC/Services/ICatalogService.cs index b126168fd..3879ad13d 100644 --- a/src/Web/WebMVC/Services/ICatalogService.cs +++ b/src/Web/WebMVC/Services/ICatalogService.cs @@ -1,8 +1,6 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.eShopOnContainers.WebMVC.ViewModels; -using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.Services diff --git a/src/Web/WebMVC/Services/IIdentityParser.cs b/src/Web/WebMVC/Services/IIdentityParser.cs index a4f98c61c..aaf2ab8cd 100644 --- a/src/Web/WebMVC/Services/IIdentityParser.cs +++ b/src/Web/WebMVC/Services/IIdentityParser.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Principal; -using System.Threading.Tasks; +using System.Security.Principal; namespace Microsoft.eShopOnContainers.WebMVC.Services { diff --git a/src/Web/WebMVC/Services/IOrderingService.cs b/src/Web/WebMVC/Services/IOrderingService.cs index 480ea4119..cc1968c53 100644 --- a/src/Web/WebMVC/Services/IOrderingService.cs +++ b/src/Web/WebMVC/Services/IOrderingService.cs @@ -1,7 +1,5 @@ using Microsoft.eShopOnContainers.WebMVC.ViewModels; -using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using WebMVC.Services.ModelDTOs; diff --git a/src/Web/WebMVC/Services/IdentityParser.cs b/src/Web/WebMVC/Services/IdentityParser.cs index 70e82e53b..5360ebed4 100644 --- a/src/Web/WebMVC/Services/IdentityParser.cs +++ b/src/Web/WebMVC/Services/IdentityParser.cs @@ -1,14 +1,12 @@ using Microsoft.eShopOnContainers.WebMVC.ViewModels; using System; -using System.Collections.Generic; using System.Linq; using System.Security.Claims; using System.Security.Principal; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.Services { - public class IdentityParser:IIdentityParser + public class IdentityParser : IIdentityParser { public ApplicationUser Parse(IPrincipal principal) { diff --git a/src/Web/WebMVC/Services/ModelDTOs/BasketDTO.cs b/src/Web/WebMVC/Services/ModelDTOs/BasketDTO.cs index 130a729f5..246991058 100644 --- a/src/Web/WebMVC/Services/ModelDTOs/BasketDTO.cs +++ b/src/Web/WebMVC/Services/ModelDTOs/BasketDTO.cs @@ -22,7 +22,7 @@ namespace WebMVC.Services.ModelDTOs [Required] public DateTime CardExpiration { get; set; } - + [Required] public string CardSecurityNumber { get; set; } @@ -31,7 +31,7 @@ namespace WebMVC.Services.ModelDTOs public string Buyer { get; set; } [Required] - public Guid RequestId { get; set; } + public Guid RequestId { get; set; } } } diff --git a/src/Web/WebMVC/Startup.cs b/src/Web/WebMVC/Startup.cs index e438e9d6c..ccae68a09 100644 --- a/src/Web/WebMVC/Startup.cs +++ b/src/Web/WebMVC/Startup.cs @@ -7,19 +7,16 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Diagnostics.HealthChecks; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Logging; using StackExchange.Redis; using System; using System.IdentityModel.Tokens.Jwt; -using System.Net.Http; using WebMVC.Infrastructure; using WebMVC.Infrastructure.Middlewares; using WebMVC.Services; @@ -46,8 +43,8 @@ namespace Microsoft.eShopOnContainers.WebMVC .AddDevspaces() .AddHttpClientServices(Configuration); - IdentityModelEventSource.ShowPII = true; // Caution! Do NOT use in production: https://aka.ms/IdentityModel/PII - + IdentityModelEventSource.ShowPII = true; // Caution! Do NOT use in production: https://aka.ms/IdentityModel/PII + services.AddControllers(); services.AddCustomAuthentication(Configuration); @@ -82,13 +79,13 @@ namespace Microsoft.eShopOnContainers.WebMVC } WebContextSeed.Seed(app, env); - + // Fix samesite issue when running eShop from docker-compose locally as by default http protocol is being used // Refer to https://github.com/dotnet-architecture/eShopOnContainers/issues/1391 - app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = AspNetCore.Http.SameSiteMode.Lax }); + app.UseCookiePolicy(new CookiePolicyOptions { MinimumSameSitePolicy = AspNetCore.Http.SameSiteMode.Lax }); app.UseRouting(); - + app.UseAuthentication(); app.UseAuthorization(); diff --git a/src/Web/WebMVC/ViewComponents/Cart.cs b/src/Web/WebMVC/ViewComponents/Cart.cs index 6cd8bf2d5..0fa004a49 100644 --- a/src/Web/WebMVC/ViewComponents/Cart.cs +++ b/src/Web/WebMVC/ViewComponents/Cart.cs @@ -1,10 +1,7 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.eShopOnContainers.WebMVC.Services; using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels; -using Microsoft.eShopOnContainers.WebMVC.Services; -using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents @@ -24,7 +21,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents vm.ItemsCount = itemsInCart; return View(vm); } - catch + catch { ViewBag.IsBasketInoperative = true; } diff --git a/src/Web/WebMVC/ViewComponents/CartList.cs b/src/Web/WebMVC/ViewComponents/CartList.cs index 88d1f9abb..f572c8437 100644 --- a/src/Web/WebMVC/ViewComponents/CartList.cs +++ b/src/Web/WebMVC/ViewComponents/CartList.cs @@ -1,9 +1,7 @@ using Microsoft.AspNetCore.Mvc; -using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.eShopOnContainers.WebMVC.Services; +using Microsoft.eShopOnContainers.WebMVC.ViewModels; using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents @@ -29,7 +27,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents return View(vm); } - + private Task GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user); } } diff --git a/src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs b/src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs index d60150a44..3819f6fb0 100644 --- a/src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs +++ b/src/Web/WebMVC/ViewModels/Annotations/CardExpiration.cs @@ -1,8 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations { @@ -24,7 +21,8 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations DateTime d = new DateTime(year, month, 1); return d > DateTime.UtcNow; - } else + } + else { return false; } diff --git a/src/Web/WebMVC/ViewModels/Annotations/LongitudeCoordinate.cs b/src/Web/WebMVC/ViewModels/Annotations/LongitudeCoordinate.cs index de2266711..de1f5cd3e 100644 --- a/src/Web/WebMVC/ViewModels/Annotations/LongitudeCoordinate.cs +++ b/src/Web/WebMVC/ViewModels/Annotations/LongitudeCoordinate.cs @@ -16,7 +16,7 @@ namespace WebMVC.ViewModels.Annotations ("Longitude must be between -180 and 180 degrees inclusive."); } - return ValidationResult.Success; + return ValidationResult.Success; } } } diff --git a/src/Web/WebMVC/ViewModels/ApplicationUser.cs b/src/Web/WebMVC/ViewModels/ApplicationUser.cs index 23016a6db..ec0318850 100644 --- a/src/Web/WebMVC/ViewModels/ApplicationUser.cs +++ b/src/Web/WebMVC/ViewModels/ApplicationUser.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using Microsoft.AspNetCore.Identity; using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Identity; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { diff --git a/src/Web/WebMVC/ViewModels/Basket.cs b/src/Web/WebMVC/ViewModels/Basket.cs index b95a910a2..cf9bdcb08 100644 --- a/src/Web/WebMVC/ViewModels/Basket.cs +++ b/src/Web/WebMVC/ViewModels/Basket.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { @@ -16,7 +15,7 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels public decimal Total() { - return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity),2); + return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2); } } } diff --git a/src/Web/WebMVC/ViewModels/BasketItem.cs b/src/Web/WebMVC/ViewModels/BasketItem.cs index ab767f8f5..2703b6def 100644 --- a/src/Web/WebMVC/ViewModels/BasketItem.cs +++ b/src/Web/WebMVC/ViewModels/BasketItem.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.WebMVC.ViewModels +namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { public class BasketItem { diff --git a/src/Web/WebMVC/ViewModels/CampaignViewModel/CampaignViewModel.cs b/src/Web/WebMVC/ViewModels/CampaignViewModel/CampaignViewModel.cs index 80018202f..e67bf27d0 100644 --- a/src/Web/WebMVC/ViewModels/CampaignViewModel/CampaignViewModel.cs +++ b/src/Web/WebMVC/ViewModels/CampaignViewModel/CampaignViewModel.cs @@ -1,11 +1,11 @@ namespace WebMVC.ViewModels { - using System.Collections.Generic; using Microsoft.eShopOnContainers.WebMVC.ViewModels; using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination; - using WebMVC.ViewModels.Annotations; using Newtonsoft.Json; + using System.Collections.Generic; using System.ComponentModel.DataAnnotations; + using WebMVC.ViewModels.Annotations; public class CampaignViewModel { diff --git a/src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs b/src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs index 9a8802542..be7d6dd1f 100644 --- a/src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs +++ b/src/Web/WebMVC/ViewModels/CartViewModels/IndexViewModel.cs @@ -1,10 +1,4 @@ -using Microsoft.AspNetCore.Mvc.Rendering; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels +namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels { public class CartComponentViewModel { diff --git a/src/Web/WebMVC/ViewModels/Catalog.cs b/src/Web/WebMVC/ViewModels/Catalog.cs index d36968565..9624c51c2 100644 --- a/src/Web/WebMVC/ViewModels/Catalog.cs +++ b/src/Web/WebMVC/ViewModels/Catalog.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; +using System.Collections.Generic; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { diff --git a/src/Web/WebMVC/ViewModels/CatalogItem.cs b/src/Web/WebMVC/ViewModels/CatalogItem.cs index c869b7382..f97adf2d5 100644 --- a/src/Web/WebMVC/ViewModels/CatalogItem.cs +++ b/src/Web/WebMVC/ViewModels/CatalogItem.cs @@ -1,6 +1,4 @@ -using System; - -namespace Microsoft.eShopOnContainers.WebMVC.ViewModels +namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { public class CatalogItem { diff --git a/src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs b/src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs index ab14b4ee4..8f70b32d9 100644 --- a/src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs +++ b/src/Web/WebMVC/ViewModels/CatalogViewModels/IndexViewModel.cs @@ -1,9 +1,6 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination; -using System; using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels { diff --git a/src/Web/WebMVC/ViewModels/Header.cs b/src/Web/WebMVC/ViewModels/Header.cs index 212638fbc..ee97a238e 100644 --- a/src/Web/WebMVC/ViewModels/Header.cs +++ b/src/Web/WebMVC/ViewModels/Header.cs @@ -1,6 +1,4 @@ -using System; - -namespace Microsoft.eShopOnContainers.WebMVC.ViewModels +namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { public class Header { diff --git a/src/Web/WebMVC/ViewModels/Order.cs b/src/Web/WebMVC/ViewModels/Order.cs index 2beaf43b1..4de37ca00 100644 --- a/src/Web/WebMVC/ViewModels/Order.cs +++ b/src/Web/WebMVC/ViewModels/Order.cs @@ -5,21 +5,19 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Threading.Tasks; using WebMVC.Services.ModelDTOs; namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { public class Order { - public string OrderNumber {get;set;} + public string OrderNumber { get; set; } - public DateTime Date {get;set;} + public DateTime Date { get; set; } public string Status { get; set; } - public decimal Total {get;set;} + public decimal Total { get; set; } public string Description { get; set; } diff --git a/src/Web/WebMVC/ViewModels/OrderItem.cs b/src/Web/WebMVC/ViewModels/OrderItem.cs index 3ba03b96a..a5eb4812c 100644 --- a/src/Web/WebMVC/ViewModels/OrderItem.cs +++ b/src/Web/WebMVC/ViewModels/OrderItem.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.WebMVC.ViewModels +namespace Microsoft.eShopOnContainers.WebMVC.ViewModels { public class OrderItem { diff --git a/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs b/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs index 0baf8e961..a10280659 100644 --- a/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs +++ b/src/Web/WebMVC/ViewModels/Pagination/PaginationInfo.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination +namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination { public class PaginationInfo { diff --git a/src/Web/WebSPA/AppSettings.cs b/src/Web/WebSPA/AppSettings.cs index 037ed858f..c1b5bf38e 100644 --- a/src/Web/WebSPA/AppSettings.cs +++ b/src/Web/WebSPA/AppSettings.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace eShopOnContainers.WebSPA +namespace eShopOnContainers.WebSPA { public class AppSettings { diff --git a/src/Web/WebSPA/Program.cs b/src/Web/WebSPA/Program.cs index d8b138e47..21d29237e 100644 --- a/src/Web/WebSPA/Program.cs +++ b/src/Web/WebSPA/Program.cs @@ -1,9 +1,9 @@ using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using System.IO; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using Serilog; +using System.IO; namespace eShopConContainers.WebSPA { @@ -36,6 +36,6 @@ namespace eShopConContainers.WebSPA .Enrich.FromLogContext() .WriteTo.Console(); }) - .Build(); + .Build(); } } diff --git a/src/Web/WebSPA/Server/Controllers/HomeController.cs b/src/Web/WebSPA/Server/Controllers/HomeController.cs index 14e8a8871..992cac113 100644 --- a/src/Web/WebSPA/Server/Controllers/HomeController.cs +++ b/src/Web/WebSPA/Server/Controllers/HomeController.cs @@ -1,9 +1,9 @@ // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 +using eShopOnContainers.WebSPA; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Options; -using eShopOnContainers.WebSPA; namespace eShopConContainers.WebSPA.Server.Controllers { @@ -20,6 +20,6 @@ namespace eShopConContainers.WebSPA.Server.Controllers public IActionResult Configuration() { return Json(_settings.Value); - } + } } } diff --git a/src/Web/WebSPA/Startup.cs b/src/Web/WebSPA/Startup.cs index 2b50e7add..134b55696 100644 --- a/src/Web/WebSPA/Startup.cs +++ b/src/Web/WebSPA/Startup.cs @@ -70,7 +70,7 @@ namespace eShopConContainers.WebSPA { app.UseDeveloperExceptionPage(); } - + // Configure XSRF middleware, This pattern is for SPA style applications where XSRF token is added on Index page // load and passed back token on every subsequent async request // app.Use(async (context, next) => diff --git a/src/Web/WebStatus/Controllers/HomeController.cs b/src/Web/WebStatus/Controllers/HomeController.cs index e87e655a6..f1673b642 100644 --- a/src/Web/WebStatus/Controllers/HomeController.cs +++ b/src/Web/WebStatus/Controllers/HomeController.cs @@ -1,8 +1,6 @@ -using HealthChecks.UI.Configuration; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using System.Linq; -using System.Threading.Tasks; namespace WebStatus.Controllers {