Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
9a322af
Merge pull request #1 from dotnet-architecture/dev
vishipayyallore Dec 1, 2020
b8431fa
Removed Unused Using and Reorganized the Using
vishipayyallore Dec 1, 2020
34241c4
Removed unused using, Reorganized using, moved the class to separate …
vishipayyallore Dec 1, 2020
9b8a207
Revert "Removed unused using, Reorganized using, moved the class to s…
vishipayyallore Dec 16, 2020
490fa43
Merge remote-tracking branch 'upstream/dev' into dev
vishipayyallore Dec 16, 2020
6e8c1ea
Merge branch 'dev' into swamy/remove-unused-using-and-refactor-the-code
vishipayyallore Dec 16, 2020
ec52d08
Removed unused using and reorganized the using inside "Services" folder
vishipayyallore Dec 16, 2020
5838a22
Removed Unused using and reoganized the using
vishipayyallore Dec 16, 2020
79f5d63
Refactor Webhooks.API
vishipayyallore Dec 16, 2020
08df050
Removed unused using and reorganized using inside Catalog.API
vishipayyallore Dec 16, 2020
e554fe5
Merge remote-tracking branch 'upstream/dev' into dev
vishipayyallore Dec 17, 2020
0989e7f
Merge branch 'dev' into swamy/remove-unused-using-and-refactor-the-code
vishipayyallore Dec 17, 2020
91ca701
Merge remote-tracking branch 'upstream/dev' into dev
vishipayyallore Dec 17, 2020
de597de
Merge branch 'dev' into swamy/remove-unused-using-and-refactor-the-code
vishipayyallore Dec 17, 2020
d88a09a
Refactoring
vishipayyallore Dec 17, 2020
c04afae
Removed unsed using
vishipayyallore Dec 17, 2020
60a4cde
Added line break just to differentiate between the messages
vishipayyallore Dec 17, 2020
3f3ff58
Merge remote-tracking branch 'upstream/dev' into swamy/remove-unused-…
vishipayyallore Dec 19, 2020
7db24e3
Removed unused usings
vishipayyallore Dec 19, 2020
8c771de
Simple Refactoring
vishipayyallore Dec 19, 2020
df26997
Merge remote-tracking branch 'upstream/dev' into dev
vishipayyallore Dec 19, 2020
9016095
Merge branch 'dev' into swamy/remove-unused-using-and-refactor-the-code
vishipayyallore Dec 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public TestServer CreateServer()
.AddEnvironmentVariables();
}).UseStartup<Startup>();

var testServer = new TestServer(hostBuilder);
var testServer = new TestServer(hostBuilder);

testServer.Host
.MigrateDbContext<CatalogContext>((context, services) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public async Task Post_update_product_price_and_catalog_and_basket_list_modified
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);

Expand All @@ -71,7 +71,7 @@ private async Task<BasketItem> GetUpdatedBasketItem(decimal newPrice, int produc
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<CustomerBasket>(await basketGetResponse.Content.ReadAsStringAsync());
Expand All @@ -92,7 +92,7 @@ private async Task<BasketItem> GetUpdatedBasketItem(decimal newPrice, int produc
return itemUpdated;
}

private async Task<PaginatedItemsViewModel<CatalogItem>> GetCatalogAsync(HttpClient catalogClient)
private async Task<PaginatedItemsViewModel<CatalogItem>> GetCatalogAsync(HttpClient catalogClient)
{
var response = await catalogClient.GetAsync(CatalogScenariosBase.Get.Items);
var items = await response.Content.ReadAsStringAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static string UserLocationRuleByCampaignAndUserLocationRuleId(int campaig

public static class Post
{
public static string AddNewuserLocationRule(int campaignId)
public static string AddNewuserLocationRule(int campaignId)
=> GetUserLocationRolesUrlBase(campaignId);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace FunctionalTests.Services.Ordering
{
public class OrderingScenarios : OrderingScenariosBase
{
{
[Fact]
public async Task Cancel_basket_and_check_order_status_cancelled()
{
Expand Down Expand Up @@ -69,7 +69,8 @@ private async Task<Order> TryGetNewOrderCreated(string city, HttpClient orderCli
var ordersGetResponse = await orderClient.GetStringAsync(OrderingScenariosBase.Get.Orders);
var orders = JsonConvert.DeserializeObject<List<Order>>(ordersGetResponse);

if (orders == null || orders.Count == 0) {
if (orders == null || orders.Count == 0)
{
counter++;
await Task.Delay(100);
continue;
Expand All @@ -84,9 +85,9 @@ private async Task<Order> TryGetNewOrderCreated(string city, HttpClient orderCli
if (IsOrderCreated(order, city))
{
break;
}
}
}
}

return order;
}

Expand Down Expand Up @@ -117,7 +118,7 @@ string BuildCancelOrder(string orderId)
var order = new OrderDTO()
{
OrderNumber = orderId
};
};
return JsonConvert.SerializeObject(order);
}

Expand All @@ -135,12 +136,11 @@ string BuildCheckout(string cityExpected)
CardExpiration = DateTime.Now.AddYears(1),
CardSecurityNumber = "123",
CardTypeId = 1,
Buyer = "Buyer",
Buyer = "Buyer",
RequestId = Guid.NewGuid()
};

return JsonConvert.SerializeObject(checkoutBasket);
}
}
}

7 changes: 1 addition & 6 deletions src/Web/WebMVC/AppSettings.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
8 changes: 4 additions & 4 deletions src/Web/WebMVC/Controllers/CampaignsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,12 +31,12 @@ public async Task<IActionResult> Index(int page = 0, int pageSize = 10)
{
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
{
Expand Down
15 changes: 7 additions & 8 deletions src/Web/WebMVC/Controllers/CatalogController.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
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
{
public class CatalogController : Controller
{
private ICatalogService _catalogSvc;

public CatalogController(ICatalogService catalogSvc) =>
public CatalogController(ICatalogService catalogSvc) =>
_catalogSvc = catalogSvc;

public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page, [FromQuery]string errorMsg)
public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilterApplied, int? page, [FromQuery] string errorMsg)
{
var itemsPage = 10;
var catalog = await _catalogSvc.GetCatalogItems(page ?? 0, itemsPage, BrandFilterApplied, TypesFilterApplied);
Expand All @@ -30,7 +29,7 @@ public async Task<IActionResult> Index(int? BrandFilterApplied, int? TypesFilter
{
ActualPage = page ?? 0,
ItemsPerPage = catalog.Data.Count,
TotalItems = catalog.Count,
TotalItems = catalog.Count,
TotalPages = (int)Math.Ceiling(((decimal)catalog.Count / itemsPage))
}
};
Expand Down
13 changes: 5 additions & 8 deletions src/Web/WebMVC/Controllers/OrderManagementController.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down Expand Up @@ -37,7 +34,7 @@ public async Task<IActionResult> OrderProcess(string orderId, string actionCode)
{
await _orderSvc.ShipOrder(orderId);
}

return RedirectToAction("Index");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Web/WebMVC/Controllers/TestController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public async Task<IActionResult> Ocelot()

if (response.IsSuccessStatusCode)
{
var str = await response.Content.ReadAsStringAsync();
var str = await response.Content.ReadAsStringAsync();

return Ok(str);
}
Expand Down
3 changes: 0 additions & 3 deletions src/Web/WebMVC/Extensions/HttpClientExtensions.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
4 changes: 0 additions & 4 deletions src/Web/WebMVC/Extensions/SessionExtensions.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage
request.Headers.Add("x-requestid", Guid.NewGuid().ToString());
}
}

return await base.SendAsync(request, cancellationToken);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -63,7 +62,7 @@ public async Task Invoke(HttpContext context)
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"),
Expand Down
6 changes: 3 additions & 3 deletions src/Web/WebMVC/Infrastructure/WebContextSeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static void Seed(IApplicationBuilder applicationBuilder, IWebHostEnvironm
static void GetPreconfiguredCSS(string contentRootPath, string webroot, ILogger log)
{
try
{
{
string overrideCssFile = Path.Combine(contentRootPath, "Setup", "override.css");
if (!File.Exists(overrideCssFile))
{
Expand All @@ -44,7 +44,7 @@ static void GetPreconfiguredCSS(string contentRootPath, string webroot, ILogger
}

string destinationFilename = Path.Combine(webroot, "css", "override.css");
File.Copy(overrideCssFile, destinationFilename, true );
File.Copy(overrideCssFile, destinationFilename, true);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -86,7 +86,7 @@ static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogg
}
}
}
catch ( Exception ex )
catch (Exception ex)
{
log.Error(ex, "EXCEPTION ERROR: {Message}", ex.Message);
}
Expand Down
10 changes: 6 additions & 4 deletions src/Web/WebMVC/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ public static int Main(string[] args)

private static IWebHost BuildWebHost(IConfiguration configuration, string[] args) =>
WebHost.CreateDefaultBuilder(args)
.CaptureStartupErrors(false)
.CaptureStartupErrors(false)
.ConfigureAppConfiguration(x => x.AddConfiguration(configuration))
.UseStartup<Startup>()
.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"];
Expand All @@ -57,10 +57,12 @@ private static Serilog.ILogger CreateSerilogLogger(IConfiguration configuration)
.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();
Expand Down
6 changes: 3 additions & 3 deletions src/Web/WebMVC/Services/BasketService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public BasketService(HttpClient httpClient, IOptions<AppSettings> settings, ILog
{
_apiClient = httpClient;
_settings = settings;
_logger =logger;
_logger = logger;

_basketByPassUrl = $"{_settings.Value.PurchaseUrl}/b/api/v1/basket";
_purchaseUrl = $"{_settings.Value.PurchaseUrl}/api/v1";
Expand All @@ -33,7 +33,7 @@ public async Task<Basket> GetBasket(ApplicationUser user)
{
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) ?
Expand Down Expand Up @@ -97,7 +97,7 @@ public async Task<Order> GetOrderDraft(string basketId)

var responseString = await _apiClient.GetStringAsync(uri);

var response = JsonConvert.DeserializeObject<Order>(responseString);
var response = JsonConvert.DeserializeObject<Order>(responseString);

return response;
}
Expand Down
2 changes: 0 additions & 2 deletions src/Web/WebMVC/Services/IBasketService.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
1 change: 0 additions & 1 deletion src/Web/WebMVC/Services/ICampaignService.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
using System.Collections.Generic;
using System.Threading.Tasks;
using ViewModels;

Expand Down
2 changes: 0 additions & 2 deletions src/Web/WebMVC/Services/ICatalogService.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 1 addition & 5 deletions src/Web/WebMVC/Services/IIdentityParser.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand Down
2 changes: 0 additions & 2 deletions src/Web/WebMVC/Services/IOrderingService.cs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Loading