Included file scope namespaces for all files
This commit is contained in:
parent
610707a5b7
commit
5e7de1617e
@ -1,5 +1,5 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC
|
namespace Microsoft.eShopOnContainers.WebMVC;
|
||||||
{
|
|
||||||
public class AppSettings
|
public class AppSettings
|
||||||
{
|
{
|
||||||
//public Connectionstrings ConnectionStrings { get; set; }
|
//public Connectionstrings ConnectionStrings { get; set; }
|
||||||
@ -27,4 +27,3 @@
|
|||||||
public string System { get; set; }
|
public string System { get; set; }
|
||||||
public string Microsoft { get; set; }
|
public string Microsoft { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Authentication;
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers;
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|
||||||
{
|
|
||||||
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
||||||
public class AccountController : Controller
|
public class AccountController : Controller
|
||||||
{
|
{
|
||||||
@ -50,4 +40,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
|
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,14 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|
||||||
{
|
|
||||||
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
||||||
public class CartController : Controller
|
public class CartController : Controller
|
||||||
{
|
{
|
||||||
@ -86,4 +77,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
ViewBag.BasketInoperativeMsg = $"Basket Service is inoperative {ex.GetType().Name} - {ex.Message}";
|
ViewBag.BasketInoperativeMsg = $"Basket Service is inoperative {ex.GetType().Name} - {ex.Message}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|
||||||
{
|
|
||||||
public class CatalogController : Controller
|
public class CatalogController : Controller
|
||||||
{
|
{
|
||||||
private ICatalogService _catalogSvc;
|
private ICatalogService _catalogSvc;
|
||||||
@ -42,4 +35,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,9 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
namespace WebMVC.Controllers;
|
||||||
|
|
||||||
namespace WebMVC.Controllers
|
|
||||||
{
|
|
||||||
public class ErrorController : Controller
|
public class ErrorController : Controller
|
||||||
{
|
{
|
||||||
public IActionResult Error() => View();
|
public IActionResult Error() => View();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
namespace Microsoft.eShopOnContainers.WebMVC.Controllers;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|
||||||
{
|
|
||||||
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
||||||
public class OrderController : Controller
|
public class OrderController : Controller
|
||||||
{
|
{
|
||||||
@ -79,4 +73,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
|
|||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,13 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
|
namespace WebMVC.Controllers;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WebMVC.Services.ModelDTOs;
|
|
||||||
|
|
||||||
namespace WebMVC.Controllers
|
|
||||||
{
|
|
||||||
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
|
||||||
public class OrderManagementController : Controller
|
public class OrderManagementController : Controller
|
||||||
{
|
{
|
||||||
@ -38,4 +30,3 @@ namespace WebMVC.Controllers
|
|||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
namespace WebMVC.Controllers;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace WebMVC.Controllers
|
|
||||||
{
|
|
||||||
class TestPayload
|
class TestPayload
|
||||||
{
|
{
|
||||||
public int CatalogItemId { get; set; }
|
public int CatalogItemId { get; set; }
|
||||||
@ -58,4 +50,3 @@ namespace WebMVC.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.WebMVC.Extensions;
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Extensions
|
|
||||||
{
|
|
||||||
public static class HttpClientExtensions
|
public static class HttpClientExtensions
|
||||||
{
|
{
|
||||||
public static void SetBasicAuthentication(this HttpClient client, string userName, string password) =>
|
public static void SetBasicAuthentication(this HttpClient client, string userName, string password) =>
|
||||||
@ -32,4 +26,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Extensions
|
|||||||
return Convert.ToBase64String(encoding.GetBytes(credential));
|
return Convert.ToBase64String(encoding.GetBytes(credential));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using Microsoft.AspNetCore.Http;
|
public static class SessionExtensions
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
|
|
||||||
public static class SessionExtensions
|
|
||||||
{
|
{
|
||||||
public static void SetObject(this ISession session, string key, object value) =>
|
public static void SetObject(this ISession session, string key, object value) =>
|
||||||
session.SetString(key,JsonSerializer.Serialize(value));
|
session.SetString(key,JsonSerializer.Serialize(value));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace WebMVC.Infrastructure
|
namespace WebMVC.Infrastructure;
|
||||||
{
|
|
||||||
public static class API
|
public static class API
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -83,4 +83,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,13 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Authentication;
|
namespace WebMVC.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Net.Http.Headers;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WebMVC.Infrastructure
|
|
||||||
{
|
|
||||||
public class HttpClientAuthorizationDelegatingHandler
|
public class HttpClientAuthorizationDelegatingHandler
|
||||||
: DelegatingHandler
|
: DelegatingHandler
|
||||||
{
|
{
|
||||||
@ -46,4 +38,3 @@ namespace WebMVC.Infrastructure
|
|||||||
.GetTokenAsync(ACCESS_TOKEN);
|
.GetTokenAsync(ACCESS_TOKEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
using System;
|
namespace WebMVC.Infrastructure;
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace WebMVC.Infrastructure
|
|
||||||
{
|
|
||||||
public class HttpClientRequestIdDelegatingHandler
|
public class HttpClientRequestIdDelegatingHandler
|
||||||
: DelegatingHandler
|
: DelegatingHandler
|
||||||
{
|
{
|
||||||
@ -26,4 +21,3 @@ namespace WebMVC.Infrastructure
|
|||||||
return await base.SendAsync(request, cancellationToken);
|
return await base.SendAsync(request, cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,16 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
namespace WebMVC.Infrastructure;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using Serilog;
|
using Serilog;
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace WebMVC.Infrastructure
|
|
||||||
{
|
|
||||||
public class WebContextSeed
|
public class WebContextSeed
|
||||||
{
|
{
|
||||||
public static void Seed(IApplicationBuilder applicationBuilder, IWebHostEnvironment env)
|
public static void Seed(IApplicationBuilder applicationBuilder, IWebHostEnvironment env)
|
||||||
@ -32,7 +22,7 @@ namespace WebMVC.Infrastructure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetPreconfiguredCSS(string contentRootPath, string webroot, Serilog.ILogger log)
|
static void GetPreconfiguredCSS(string contentRootPath, string webroot, ILogger log)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -52,7 +42,7 @@ namespace WebMVC.Infrastructure
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetPreconfiguredImages(string contentRootPath, string webroot, Serilog.ILogger log)
|
static void GetPreconfiguredImages(string contentRootPath, string webroot, ILogger log)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -93,5 +83,3 @@ namespace WebMVC.Infrastructure
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -1,13 +1,4 @@
|
|||||||
using Microsoft.AspNetCore;
|
var configuration = GetConfiguration();
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC;
|
|
||||||
using Microsoft.Extensions.Configuration;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Serilog;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
var configuration = GetConfiguration();
|
|
||||||
|
|
||||||
Log.Logger = CreateSerilogLogger(configuration);
|
Log.Logger = CreateSerilogLogger(configuration);
|
||||||
|
|
||||||
|
@ -1,16 +1,7 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WebMVC.Infrastructure;
|
|
||||||
using WebMVC.Services.ModelDTOs;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public class BasketService : IBasketService
|
public class BasketService : IBasketService
|
||||||
{
|
{
|
||||||
private readonly IOptions<AppSettings> _settings;
|
private readonly IOptions<AppSettings> _settings;
|
||||||
@ -127,4 +118,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
var response = await _apiClient.PostAsync(uri, basketContent);
|
var response = await _apiClient.PostAsync(uri, basketContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WebMVC.Infrastructure;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public class CatalogService : ICatalogService
|
public class CatalogService : ICatalogService
|
||||||
{
|
{
|
||||||
private readonly IOptions<AppSettings> _settings;
|
private readonly IOptions<AppSettings> _settings;
|
||||||
@ -88,4 +78,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using WebMVC.Services.ModelDTOs;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface IBasketService
|
public interface IBasketService
|
||||||
{
|
{
|
||||||
Task<Basket> GetBasket(ApplicationUser user);
|
Task<Basket> GetBasket(ApplicationUser user);
|
||||||
@ -14,4 +11,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
Task<Basket> SetQuantities(ApplicationUser user, Dictionary<string, int> quantities);
|
Task<Basket> SetQuantities(ApplicationUser user, Dictionary<string, int> quantities);
|
||||||
Task<Order> GetOrderDraft(string basketId);
|
Task<Order> GetOrderDraft(string basketId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface ICatalogService
|
public interface ICatalogService
|
||||||
{
|
{
|
||||||
Task<Catalog> GetCatalogItems(int page, int take, int? brand, int? type);
|
Task<Catalog> GetCatalogItems(int page, int take, int? brand, int? type);
|
||||||
Task<IEnumerable<SelectListItem>> GetBrands();
|
Task<IEnumerable<SelectListItem>> GetBrands();
|
||||||
Task<IEnumerable<SelectListItem>> GetTypes();
|
Task<IEnumerable<SelectListItem>> GetTypes();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
using System.Security.Principal;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface IIdentityParser<T>
|
public interface IIdentityParser<T>
|
||||||
{
|
{
|
||||||
T Parse(IPrincipal principal);
|
T Parse(IPrincipal principal);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using System.Collections.Generic;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WebMVC.Services.ModelDTOs;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public interface IOrderingService
|
public interface IOrderingService
|
||||||
{
|
{
|
||||||
Task<List<Order>> GetMyOrders(ApplicationUser user);
|
Task<List<Order>> GetMyOrders(ApplicationUser user);
|
||||||
@ -15,4 +11,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
BasketDTO MapOrderToBasket(Order order);
|
BasketDTO MapOrderToBasket(Order order);
|
||||||
void OverrideUserInfoIntoOrder(Order original, Order destination);
|
void OverrideUserInfoIntoOrder(Order original, Order destination);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Security.Claims;
|
|
||||||
using System.Security.Principal;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public class IdentityParser : IIdentityParser<ApplicationUser>
|
public class IdentityParser : IIdentityParser<ApplicationUser>
|
||||||
{
|
{
|
||||||
public ApplicationUser Parse(IPrincipal principal)
|
public ApplicationUser Parse(IPrincipal principal)
|
||||||
@ -37,6 +31,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
throw new ArgumentException(message: "The principal must be a ClaimsPrincipal", paramName: nameof(principal));
|
throw new ArgumentException(message: "The principal must be a ClaimsPrincipal", paramName: nameof(principal));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
namespace WebMVC.Services.ModelDTOs;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace WebMVC.Services.ModelDTOs
|
|
||||||
{
|
|
||||||
public record BasketDTO
|
public record BasketDTO
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
@ -33,5 +30,3 @@ namespace WebMVC.Services.ModelDTOs
|
|||||||
[Required]
|
[Required]
|
||||||
public Guid RequestId { get; init; }
|
public Guid RequestId { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
namespace WebMVC.Services.ModelDTOs
|
namespace WebMVC.Services.ModelDTOs;
|
||||||
{
|
|
||||||
public record LocationDTO
|
public record LocationDTO
|
||||||
{
|
{
|
||||||
public double Longitude { get; init; }
|
public double Longitude { get; init; }
|
||||||
public double Latitude { get; init; }
|
public double Latitude { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
namespace WebMVC.Services.ModelDTOs;
|
||||||
|
|
||||||
namespace WebMVC.Services.ModelDTOs
|
|
||||||
{
|
|
||||||
public record OrderDTO
|
public record OrderDTO
|
||||||
{
|
{
|
||||||
[Required]
|
[Required]
|
||||||
public string OrderNumber { get; init; }
|
public string OrderNumber { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,5 +1,5 @@
|
|||||||
namespace WebMVC.Services.ModelDTOs
|
namespace WebMVC.Services.ModelDTOs;
|
||||||
{
|
|
||||||
public record OrderProcessAction
|
public record OrderProcessAction
|
||||||
{
|
{
|
||||||
public string Code { get; }
|
public string Code { get; }
|
||||||
@ -17,4 +17,3 @@
|
|||||||
Name = name;
|
Name = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,15 +1,7 @@
|
|||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
namespace Microsoft.eShopOnContainers.WebMVC.Services;
|
||||||
using Microsoft.Extensions.Options;
|
|
||||||
using System;
|
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Net.Http;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using WebMVC.Infrastructure;
|
|
||||||
using WebMVC.Services.ModelDTOs;
|
|
||||||
using System.Text.Json;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|
||||||
{
|
|
||||||
public class OrderingService : IOrderingService
|
public class OrderingService : IOrderingService
|
||||||
{
|
{
|
||||||
private HttpClient _httpClient;
|
private HttpClient _httpClient;
|
||||||
@ -146,4 +138,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,26 +1,5 @@
|
|||||||
using Devspaces.Support;
|
namespace Microsoft.eShopOnContainers.WebMVC;
|
||||||
using HealthChecks.UI.Client;
|
|
||||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.DataProtection;
|
|
||||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
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.IdentityModel.Logging;
|
|
||||||
using StackExchange.Redis;
|
|
||||||
using System;
|
|
||||||
using System.IdentityModel.Tokens.Jwt;
|
|
||||||
using WebMVC.Infrastructure;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC
|
|
||||||
{
|
|
||||||
public class Startup
|
public class Startup
|
||||||
{
|
{
|
||||||
public Startup(IConfiguration configuration)
|
public Startup(IConfiguration configuration)
|
||||||
@ -209,4 +188,3 @@ namespace Microsoft.eShopOnContainers.WebMVC
|
|||||||
return services;
|
return services;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|
||||||
{
|
|
||||||
public class Cart : ViewComponent
|
public class Cart : ViewComponent
|
||||||
{
|
{
|
||||||
private readonly IBasketService _cartSvc;
|
private readonly IBasketService _cartSvc;
|
||||||
@ -34,4 +28,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|||||||
return basket.Items.Count;
|
return basket.Items.Count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|
||||||
{
|
|
||||||
public class CartList : ViewComponent
|
public class CartList : ViewComponent
|
||||||
{
|
{
|
||||||
private readonly IBasketService _cartSvc;
|
private readonly IBasketService _cartSvc;
|
||||||
@ -30,4 +24,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|||||||
|
|
||||||
private Task<Basket> GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user);
|
private Task<Basket> GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations
|
|
||||||
{
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
|
||||||
public class CardExpirationAttribute : ValidationAttribute
|
public class CardExpirationAttribute : ValidationAttribute
|
||||||
{
|
{
|
||||||
@ -28,4 +25,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
namespace WebMVC.ViewModels.Annotations;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace WebMVC.ViewModels.Annotations
|
|
||||||
{
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
|
||||||
public class LatitudeCoordinate : ValidationAttribute
|
public class LatitudeCoordinate : ValidationAttribute
|
||||||
{
|
{
|
||||||
@ -19,4 +16,3 @@ namespace WebMVC.ViewModels.Annotations
|
|||||||
return ValidationResult.Success;
|
return ValidationResult.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
namespace WebMVC.ViewModels.Annotations;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace WebMVC.ViewModels.Annotations
|
|
||||||
{
|
|
||||||
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
|
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
|
||||||
public class LongitudeCoordinate : ValidationAttribute
|
public class LongitudeCoordinate : ValidationAttribute
|
||||||
{
|
{
|
||||||
@ -19,4 +16,3 @@ namespace WebMVC.ViewModels.Annotations
|
|||||||
return ValidationResult.Success;
|
return ValidationResult.Success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Identity;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
// Add profile data for application users by adding properties to the ApplicationUser class
|
// Add profile data for application users by adding properties to the ApplicationUser class
|
||||||
public class ApplicationUser : IdentityUser
|
public class ApplicationUser : IdentityUser
|
||||||
{
|
{
|
||||||
@ -25,4 +22,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
[Required]
|
[Required]
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
public record Basket
|
public record Basket
|
||||||
{
|
{
|
||||||
// Use property initializer syntax.
|
// Use property initializer syntax.
|
||||||
@ -18,4 +14,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2);
|
return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
{
|
|
||||||
public record BasketItem
|
public record BasketItem
|
||||||
{
|
{
|
||||||
public string Id { get; init; }
|
public string Id { get; init; }
|
||||||
@ -10,4 +10,3 @@
|
|||||||
public int Quantity { get; init; }
|
public int Quantity { get; init; }
|
||||||
public string PictureUrl { get; init; }
|
public string PictureUrl { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
public record Campaign
|
public record Campaign
|
||||||
{
|
{
|
||||||
public int PageIndex { get; init; }
|
public int PageIndex { get; init; }
|
||||||
@ -9,4 +7,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
public int Count { get; init; }
|
public int Count { get; init; }
|
||||||
public List<CampaignItem> Data { get; init; }
|
public List<CampaignItem> Data { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
public record CampaignItem
|
public record CampaignItem
|
||||||
{
|
{
|
||||||
public int Id { get; init; }
|
public int Id { get; init; }
|
||||||
@ -17,4 +15,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
public string PictureUri { get; init; }
|
public string PictureUri { get; init; }
|
||||||
public string DetailsUri { get; init; }
|
public string DetailsUri { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,8 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels;
|
||||||
{
|
|
||||||
public class CartComponentViewModel
|
public class CartComponentViewModel
|
||||||
{
|
{
|
||||||
public int ItemsCount { get; set; }
|
public int ItemsCount { get; set; }
|
||||||
public string Disabled => (ItemsCount == 0) ? "is-disabled" : "";
|
public string Disabled => (ItemsCount == 0) ? "is-disabled" : "";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
public record Catalog
|
public record Catalog
|
||||||
{
|
{
|
||||||
public int PageIndex { get; init; }
|
public int PageIndex { get; init; }
|
||||||
@ -9,4 +7,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
public int Count { get; init; }
|
public int Count { get; init; }
|
||||||
public List<CatalogItem> Data { get; init; }
|
public List<CatalogItem> Data { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
{
|
|
||||||
public record CatalogItem
|
public record CatalogItem
|
||||||
{
|
{
|
||||||
public int Id { get; init; }
|
public int Id { get; init; }
|
||||||
@ -12,4 +12,3 @@
|
|||||||
public int CatalogTypeId { get; init; }
|
public int CatalogTypeId { get; init; }
|
||||||
public string CatalogType { get; init; }
|
public string CatalogType { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,9 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels
|
|
||||||
{
|
|
||||||
public class IndexViewModel
|
public class IndexViewModel
|
||||||
{
|
{
|
||||||
public IEnumerable<CatalogItem> CatalogItems { get; set; }
|
public IEnumerable<CatalogItem> CatalogItems { get; set; }
|
||||||
@ -13,4 +9,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels
|
|||||||
public int? TypesFilterApplied { get; set; }
|
public int? TypesFilterApplied { get; set; }
|
||||||
public PaginationInfo PaginationInfo { get; set; }
|
public PaginationInfo PaginationInfo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
using System;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
public class NumberToStringConverter : JsonConverter<string>
|
public class NumberToStringConverter : JsonConverter<string>
|
||||||
{
|
{
|
||||||
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
@ -31,4 +24,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
writer.WriteStringValue(value);
|
writer.WriteStringValue(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
{
|
|
||||||
public record Header
|
public record Header
|
||||||
{
|
{
|
||||||
public string Controller { get; init; }
|
public string Controller { get; init; }
|
||||||
public string Text { get; init; }
|
public string Text { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,14 +1,5 @@
|
|||||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Text.Json.Serialization;
|
|
||||||
using WebMVC.Services.ModelDTOs;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|
||||||
{
|
|
||||||
public class Order
|
public class Order
|
||||||
{
|
{
|
||||||
[JsonConverter(typeof(NumberToStringConverter))]
|
[JsonConverter(typeof(NumberToStringConverter))]
|
||||||
@ -98,4 +89,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
|||||||
{
|
{
|
||||||
AMEX = 1
|
AMEX = 1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
|
||||||
{
|
|
||||||
public record OrderItem
|
public record OrderItem
|
||||||
{
|
{
|
||||||
public int ProductId { get; init; }
|
public int ProductId { get; init; }
|
||||||
@ -14,4 +14,3 @@
|
|||||||
|
|
||||||
public string PictureUrl { get; init; }
|
public string PictureUrl { get; init; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination
|
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
|
||||||
{
|
|
||||||
public class PaginationInfo
|
public class PaginationInfo
|
||||||
{
|
{
|
||||||
public int TotalItems { get; set; }
|
public int TotalItems { get; set; }
|
||||||
@ -9,4 +9,3 @@
|
|||||||
public string Previous { get; set; }
|
public string Previous { get; set; }
|
||||||
public string Next { get; set; }
|
public string Next { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user