Included file scope namespaces for all files

This commit is contained in:
Sumit Ghosh 2021-10-20 16:04:59 +05:30
parent 610707a5b7
commit 5e7de1617e
47 changed files with 1299 additions and 1567 deletions

View File

@ -1,5 +1,5 @@
namespace Microsoft.eShopOnContainers.WebMVC
{
namespace Microsoft.eShopOnContainers.WebMVC;
public class AppSettings
{
//public Connectionstrings ConnectionStrings { get; set; }
@ -27,4 +27,3 @@
public string System { get; set; }
public string Microsoft { get; set; }
}
}

View File

@ -1,15 +1,5 @@
using Microsoft.AspNetCore.Authentication;
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;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class AccountController : Controller
{
@ -50,4 +40,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
new AspNetCore.Authentication.AuthenticationProperties { RedirectUri = homeUrl });
}
}
}

View File

@ -1,14 +1,5 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
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;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class CartController : Controller
{
@ -86,4 +77,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
ViewBag.BasketInoperativeMsg = $"Basket Service is inoperative {ex.GetType().Name} - {ex.Message}";
}
}
}

View File

@ -1,12 +1,5 @@
using Microsoft.AspNetCore.Mvc;
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;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
public class CatalogController : Controller
{
private ICatalogService _catalogSvc;
@ -42,4 +35,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
return View(vm);
}
}
}

View File

@ -1,9 +1,6 @@
using Microsoft.AspNetCore.Mvc;
namespace WebMVC.Controllers;
namespace WebMVC.Controllers
{
public class ErrorController : Controller
{
public IActionResult Error() => View();
}
}

View File

@ -1,13 +1,7 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class OrderController : Controller
{
@ -79,4 +73,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Controllers
return View(vm);
}
}
}

View File

@ -1,13 +1,5 @@
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
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;
namespace WebMVC.Controllers
{
[Authorize(AuthenticationSchemes = OpenIdConnectDefaults.AuthenticationScheme)]
public class OrderManagementController : Controller
{
@ -38,4 +30,3 @@ namespace WebMVC.Controllers
return RedirectToAction("Index");
}
}
}

View File

@ -1,13 +1,5 @@
using Microsoft.AspNetCore.Authorization;
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;
namespace WebMVC.Controllers
{
class TestPayload
{
public int CatalogItemId { get; set; }
@ -58,4 +50,3 @@ namespace WebMVC.Controllers
}
}
}
}

View File

@ -1,11 +1,5 @@
using System;
using System.IdentityModel.Tokens.Jwt;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
namespace Microsoft.eShopOnContainers.WebMVC.Extensions;
namespace Microsoft.eShopOnContainers.WebMVC.Extensions
{
public static class HttpClientExtensions
{
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));
}
}
}

View File

@ -1,8 +1,4 @@
using Microsoft.AspNetCore.Http;
using System.Text.Json;
public static class SessionExtensions
public static class SessionExtensions
{
public static void SetObject(this ISession session, string key, object value) =>
session.SetString(key,JsonSerializer.Serialize(value));

View File

@ -1,5 +1,5 @@
namespace WebMVC.Infrastructure
{
namespace WebMVC.Infrastructure;
public static class API
{
@ -83,4 +83,3 @@
}
}
}
}

View File

@ -1,13 +1,5 @@
using Microsoft.AspNetCore.Authentication;
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;
namespace WebMVC.Infrastructure
{
public class HttpClientAuthorizationDelegatingHandler
: DelegatingHandler
{
@ -46,4 +38,3 @@ namespace WebMVC.Infrastructure
.GetTokenAsync(ACCESS_TOKEN);
}
}
}

View File

@ -1,10 +1,5 @@
using System;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace WebMVC.Infrastructure;
namespace WebMVC.Infrastructure
{
public class HttpClientRequestIdDelegatingHandler
: DelegatingHandler
{
@ -26,4 +21,3 @@ namespace WebMVC.Infrastructure
return await base.SendAsync(request, cancellationToken);
}
}
}

View File

@ -1,16 +1,6 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.eShopOnContainers.WebMVC;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace WebMVC.Infrastructure;
using Serilog;
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
namespace WebMVC.Infrastructure
{
public class WebContextSeed
{
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
{
@ -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
{
@ -93,5 +83,3 @@ namespace WebMVC.Infrastructure
}
}
}

View File

@ -1,13 +1,4 @@
using Microsoft.AspNetCore;
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();
var configuration = GetConfiguration();
Log.Logger = CreateSerilogLogger(configuration);

View File

@ -1,16 +1,7 @@
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
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;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public class BasketService : IBasketService
{
private readonly IOptions<AppSettings> _settings;
@ -127,4 +118,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
var response = await _apiClient.PostAsync(uri, basketContent);
}
}
}

View File

@ -1,15 +1,5 @@
using Microsoft.AspNetCore.Mvc.Rendering;
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;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public class CatalogService : ICatalogService
{
private readonly IOptions<AppSettings> _settings;
@ -88,4 +78,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
return items;
}
}
}

View File

@ -1,10 +1,7 @@
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System.Collections.Generic;
using System.Threading.Tasks;
using WebMVC.Services.ModelDTOs;
namespace Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public interface IBasketService
{
Task<Basket> GetBasket(ApplicationUser user);
@ -14,4 +11,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
Task<Basket> SetQuantities(ApplicationUser user, Dictionary<string, int> quantities);
Task<Order> GetOrderDraft(string basketId);
}
}

View File

@ -1,14 +1,8 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.Services;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public interface ICatalogService
{
Task<Catalog> GetCatalogItems(int page, int take, int? brand, int? type);
Task<IEnumerable<SelectListItem>> GetBrands();
Task<IEnumerable<SelectListItem>> GetTypes();
}
}

View File

@ -1,9 +1,6 @@
using System.Security.Principal;
namespace Microsoft.eShopOnContainers.WebMVC.Services;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public interface IIdentityParser<T>
{
T Parse(IPrincipal principal);
}
}

View File

@ -1,10 +1,6 @@
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System.Collections.Generic;
using System.Threading.Tasks;
using WebMVC.Services.ModelDTOs;
namespace Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public interface IOrderingService
{
Task<List<Order>> GetMyOrders(ApplicationUser user);
@ -15,4 +11,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
BasketDTO MapOrderToBasket(Order order);
void OverrideUserInfoIntoOrder(Order original, Order destination);
}
}

View File

@ -1,11 +1,5 @@
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Linq;
using System.Security.Claims;
using System.Security.Principal;
namespace Microsoft.eShopOnContainers.WebMVC.Services;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public class IdentityParser : IIdentityParser<ApplicationUser>
{
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));
}
}
}

View File

@ -1,8 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace WebMVC.Services.ModelDTOs;
namespace WebMVC.Services.ModelDTOs
{
public record BasketDTO
{
[Required]
@ -33,5 +30,3 @@ namespace WebMVC.Services.ModelDTOs
[Required]
public Guid RequestId { get; init; }
}
}

View File

@ -1,8 +1,7 @@
namespace WebMVC.Services.ModelDTOs
{
namespace WebMVC.Services.ModelDTOs;
public record LocationDTO
{
public double Longitude { get; init; }
public double Latitude { get; init; }
}
}

View File

@ -1,10 +1,7 @@
using System.ComponentModel.DataAnnotations;
namespace WebMVC.Services.ModelDTOs;
namespace WebMVC.Services.ModelDTOs
{
public record OrderDTO
{
[Required]
public string OrderNumber { get; init; }
}
}

View File

@ -1,5 +1,5 @@
namespace WebMVC.Services.ModelDTOs
{
namespace WebMVC.Services.ModelDTOs;
public record OrderProcessAction
{
public string Code { get; }
@ -17,4 +17,3 @@
Name = name;
}
}
}

View File

@ -1,15 +1,7 @@
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using Microsoft.Extensions.Options;
using System;
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;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.Services
{
public class OrderingService : IOrderingService
{
private HttpClient _httpClient;
@ -146,4 +138,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.Services
};
}
}
}

View File

@ -1,26 +1,5 @@
using Devspaces.Support;
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;
namespace Microsoft.eShopOnContainers.WebMVC
{
public class Startup
{
public Startup(IConfiguration configuration)
@ -209,4 +188,3 @@ namespace Microsoft.eShopOnContainers.WebMVC
return services;
}
}
}

View File

@ -1,11 +1,5 @@
using Microsoft.AspNetCore.Mvc;
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;
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
{
public class Cart : ViewComponent
{
private readonly IBasketService _cartSvc;
@ -34,4 +28,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
return basket.Items.Count;
}
}
}

View File

@ -1,11 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.eShopOnContainers.WebMVC.Services;
using Microsoft.eShopOnContainers.WebMVC.ViewModels;
using System;
using System.Threading.Tasks;
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents;
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
{
public class CartList : ViewComponent
{
private readonly IBasketService _cartSvc;
@ -30,4 +24,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
private Task<Basket> GetItemsAsync(ApplicationUser user) => _cartSvc.GetBasket(user);
}
}

View File

@ -1,8 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class CardExpirationAttribute : ValidationAttribute
{
@ -28,4 +25,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Annotations
}
}
}
}

View File

@ -1,8 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace WebMVC.ViewModels.Annotations;
namespace WebMVC.ViewModels.Annotations
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class LatitudeCoordinate : ValidationAttribute
{
@ -19,4 +16,3 @@ namespace WebMVC.ViewModels.Annotations
return ValidationResult.Success;
}
}
}

View File

@ -1,8 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace WebMVC.ViewModels.Annotations;
namespace WebMVC.ViewModels.Annotations
{
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = true)]
public class LongitudeCoordinate : ValidationAttribute
{
@ -19,4 +16,3 @@ namespace WebMVC.ViewModels.Annotations
return ValidationResult.Success;
}
}
}

View File

@ -1,8 +1,5 @@
using Microsoft.AspNetCore.Identity;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
@ -25,4 +22,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
[Required]
public string LastName { get; set; }
}
}

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public record Basket
{
// Use property initializer syntax.
@ -18,4 +14,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
return Math.Round(Items.Sum(x => x.UnitPrice * x.Quantity), 2);
}
}
}

View File

@ -1,5 +1,5 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
public record BasketItem
{
public string Id { get; init; }
@ -10,4 +10,3 @@
public int Quantity { get; init; }
public string PictureUrl { get; init; }
}
}

View File

@ -1,7 +1,5 @@
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public record Campaign
{
public int PageIndex { get; init; }
@ -9,4 +7,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
public int Count { get; init; }
public List<CampaignItem> Data { get; init; }
}
}

View File

@ -1,7 +1,5 @@
using System;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public record CampaignItem
{
public int Id { get; init; }
@ -17,4 +15,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
public string PictureUri { get; init; }
public string DetailsUri { get; init; }
}
}

View File

@ -1,8 +1,7 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels
{
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CartViewModels;
public class CartComponentViewModel
{
public int ItemsCount { get; set; }
public string Disabled => (ItemsCount == 0) ? "is-disabled" : "";
}
}

View File

@ -1,7 +1,5 @@
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public record Catalog
{
public int PageIndex { get; init; }
@ -9,4 +7,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
public int Count { get; init; }
public List<CatalogItem> Data { get; init; }
}
}

View File

@ -1,5 +1,5 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
public record CatalogItem
{
public int Id { get; init; }
@ -12,4 +12,3 @@
public int CatalogTypeId { get; init; }
public string CatalogType { get; init; }
}
}

View File

@ -1,9 +1,5 @@
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
using System.Collections.Generic;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels
{
public class IndexViewModel
{
public IEnumerable<CatalogItem> CatalogItems { get; set; }
@ -13,4 +9,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.CatalogViewModels
public int? TypesFilterApplied { get; set; }
public PaginationInfo PaginationInfo { get; set; }
}
}

View File

@ -1,12 +1,5 @@
using System;
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;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class NumberToStringConverter : JsonConverter<string>
{
public override string Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
@ -31,4 +24,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
writer.WriteStringValue(value);
}
}
}

View File

@ -1,8 +1,7 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
public record Header
{
public string Controller { get; init; }
public string Text { get; init; }
}
}

View File

@ -1,14 +1,5 @@
using Microsoft.AspNetCore.Mvc.Rendering;
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;
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
public class Order
{
[JsonConverter(typeof(NumberToStringConverter))]
@ -98,4 +89,3 @@ namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
AMEX = 1
}
}

View File

@ -1,5 +1,5 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels
{
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels;
public record OrderItem
{
public int ProductId { get; init; }
@ -14,4 +14,3 @@
public string PictureUrl { get; init; }
}
}

View File

@ -1,5 +1,5 @@
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination
{
namespace Microsoft.eShopOnContainers.WebMVC.ViewModels.Pagination;
public class PaginationInfo
{
public int TotalItems { get; set; }
@ -9,4 +9,3 @@
public string Previous { get; set; }
public string Next { get; set; }
}
}