Refactored namespace statements in catalog.api project

This commit is contained in:
Sumit Ghosh 2021-10-11 18:44:14 +05:30
parent a598bfde6c
commit 986262a833
32 changed files with 1782 additions and 1819 deletions

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API namespace Microsoft.eShopOnContainers.Services.Catalog.API;
public class CatalogSettings
{ {
public class CatalogSettings
{
public string PicBaseUrl { get; set; } public string PicBaseUrl { get; set; }
public string EventBusConnection { get; set; } public string EventBusConnection { get; set; }
@ -9,5 +9,4 @@
public bool UseCustomizationData { get; set; } public bool UseCustomizationData { get; set; }
public bool AzureStorageEnabled { get; set; } public bool AzureStorageEnabled { get; set; }
}
} }

View File

@ -1,10 +1,9 @@
using Microsoft.eShopOnContainers.Services.Catalog.API.Model; namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
[Route("api/v1/[controller]")]
[ApiController]
public class CatalogController : ControllerBase
{ {
[Route("api/v1/[controller]")]
[ApiController]
public class CatalogController : ControllerBase
{
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
private readonly CatalogSettings _settings; private readonly CatalogSettings _settings;
private readonly ICatalogIntegrationEventService _catalogIntegrationEventService; private readonly ICatalogIntegrationEventService _catalogIntegrationEventService;
@ -298,5 +297,4 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
return items; return items;
} }
}
} }

View File

@ -1,13 +1,11 @@
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers public class HomeController : Controller
{ {
public class HomeController : Controller
{
// GET: /<controller>/ // GET: /<controller>/
public IActionResult Index() public IActionResult Index()
{ {
return new RedirectResult("~/swagger"); return new RedirectResult("~/swagger");
} }
}
} }

View File

@ -1,9 +1,9 @@
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 // For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers;
[ApiController]
public class PicController : ControllerBase
{ {
[ApiController]
public class PicController : ControllerBase
{
private readonly IWebHostEnvironment _env; private readonly IWebHostEnvironment _env;
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
@ -83,5 +83,4 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers
return mimetype; return mimetype;
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model;
public static class CatalogItemExtensions
{ {
public static class CatalogItemExtensions
{
public static void FillProductUrl(this CatalogItem item, string picBaseUrl, bool azureStorageEnabled) public static void FillProductUrl(this CatalogItem item, string picBaseUrl, bool azureStorageEnabled)
{ {
if (item != null) if (item != null)
@ -11,5 +11,4 @@
: picBaseUrl.Replace("[0]", item.Id.ToString()); : picBaseUrl.Replace("[0]", item.Id.ToString());
} }
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Catalog.API.Extensions namespace Catalog.API.Extensions;
public static class HostExtensions
{ {
public static class HostExtensions
{
public static bool IsInKubernetes(this IHost host) public static bool IsInKubernetes(this IHost host)
{ {
var cfg = host.Services.GetService<IConfiguration>(); var cfg = host.Services.GetService<IConfiguration>();
@ -67,5 +67,4 @@
context.Database.Migrate(); context.Database.Migrate();
seeder(context, services); seeder(context, services);
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Catalog.API.Extensions namespace Microsoft.eShopOnContainers.Services.Catalog.API.Extensions;
public static class LinqSelectExtensions
{ {
public static class LinqSelectExtensions
{
public static IEnumerable<SelectTryResult<TSource, TResult>> SelectTry<TSource, TResult>(this IEnumerable<TSource> enumerable, Func<TSource, TResult> selector) public static IEnumerable<SelectTryResult<TSource, TResult>> SelectTry<TSource, TResult>(this IEnumerable<TSource> enumerable, Func<TSource, TResult> selector)
{ {
foreach (TSource element in enumerable) foreach (TSource element in enumerable)
@ -42,5 +42,4 @@
public TResult Result { get; private set; } public TResult Result { get; private set; }
public Exception CaughtException { get; private set; } public Exception CaughtException { get; private set; }
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Catalog.API.Extensions namespace Microsoft.eShopOnContainers.Services.Catalog.API.Extensions;
public static class WebHostExtensions
{ {
public static class WebHostExtensions
{
public static bool IsInKubernetes(this IWebHost host) public static bool IsInKubernetes(this IWebHost host)
{ {
var cfg = host.Services.GetService<IConfiguration>(); var cfg = host.Services.GetService<IConfiguration>();
@ -67,5 +67,4 @@
context.Database.Migrate(); context.Database.Migrate();
seeder(context, services); seeder(context, services);
} }
}
} }

View File

@ -2,10 +2,10 @@
global using Azure.Identity; global using Azure.Identity;
global using Autofac.Extensions.DependencyInjection; global using Autofac.Extensions.DependencyInjection;
global using Autofac; global using Autofac;
global using Catalog.API.Extensions; global using Microsoft.eShopOnContainers.Services.Catalog.API.Extensions;
global using Catalog.API.Infrastructure.ActionResults; global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.ActionResults;
global using Catalog.API.Infrastructure.Exceptions; global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Exceptions;
global using global::Catalog.API.IntegrationEvents; global using Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents;
global using Grpc.Core; global using Grpc.Core;
global using Microsoft.AspNetCore.Hosting; global using Microsoft.AspNetCore.Hosting;
global using Microsoft.AspNetCore.Http; global using Microsoft.AspNetCore.Http;
@ -48,7 +48,7 @@ global using System.Net;
global using System.Text.RegularExpressions; global using System.Text.RegularExpressions;
global using System.Threading.Tasks; global using System.Threading.Tasks;
global using System; global using System;
global using global::Catalog.API.Infrastructure.Filters; global using Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Filters;
global using HealthChecks.UI.Client; global using HealthChecks.UI.Client;
global using Microsoft.AspNetCore.Diagnostics.HealthChecks; global using Microsoft.AspNetCore.Diagnostics.HealthChecks;
global using Microsoft.Azure.ServiceBus; global using Microsoft.Azure.ServiceBus;

View File

@ -1,13 +1,13 @@
using CatalogApi; using CatalogApi;
using static CatalogApi.Catalog; using static CatalogApi.Catalog;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Grpc namespace Microsoft.eShopOnContainers.Services.Catalog.API.Grpc;
public class CatalogService : CatalogBase
{ {
public class CatalogService : CatalogBase
{
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
private readonly CatalogSettings _settings; private readonly CatalogSettings _settings;
private readonly Extensions.Logging.ILogger _logger; private readonly Microsoft.Extensions.Logging.ILogger _logger;
public CatalogService(CatalogContext dbContext, IOptions<CatalogSettings> settings, ILogger<CatalogService> logger) public CatalogService(CatalogContext dbContext, IOptions<CatalogSettings> settings, ILogger<CatalogService> logger)
{ {
@ -173,5 +173,4 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Grpc
return items; return items;
} }
}
} }

View File

@ -1,11 +1,10 @@
namespace Catalog.API.Infrastructure.ActionResults namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.ActionResults;
public class InternalServerErrorObjectResult : ObjectResult
{ {
public class InternalServerErrorObjectResult : ObjectResult
{
public InternalServerErrorObjectResult(object error) public InternalServerErrorObjectResult(object error)
: base(error) : base(error)
{ {
StatusCode = StatusCodes.Status500InternalServerError; StatusCode = StatusCodes.Status500InternalServerError;
} }
}
} }

View File

@ -1,9 +1,9 @@
using Microsoft.eShopOnContainers.Services.Catalog.API.Model; using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
public class CatalogContext : DbContext
{ {
public class CatalogContext : DbContext
{
public CatalogContext(DbContextOptions<CatalogContext> options) : base(options) public CatalogContext(DbContextOptions<CatalogContext> options) : base(options)
{ {
} }
@ -17,11 +17,11 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
builder.ApplyConfiguration(new CatalogTypeEntityTypeConfiguration()); builder.ApplyConfiguration(new CatalogTypeEntityTypeConfiguration());
builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration()); builder.ApplyConfiguration(new CatalogItemEntityTypeConfiguration());
} }
} }
public class CatalogContextDesignFactory : IDesignTimeDbContextFactory<CatalogContext> public class CatalogContextDesignFactory : IDesignTimeDbContextFactory<CatalogContext>
{ {
public CatalogContext CreateDbContext(string[] args) public CatalogContext CreateDbContext(string[] args)
{ {
var optionsBuilder = new DbContextOptionsBuilder<CatalogContext>() var optionsBuilder = new DbContextOptionsBuilder<CatalogContext>()
@ -29,5 +29,4 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
return new CatalogContext(optionsBuilder.Options); return new CatalogContext(optionsBuilder.Options);
} }
}
} }

View File

@ -1,9 +1,9 @@
using Microsoft.eShopOnContainers.Services.Catalog.API.Model; using Microsoft.eShopOnContainers.Services.Catalog.API.Model;
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure;
public class CatalogContextSeed
{ {
public class CatalogContextSeed
{
public async Task SeedAsync(CatalogContext context, IWebHostEnvironment env, IOptions<CatalogSettings> settings, ILogger<CatalogContextSeed> logger) public async Task SeedAsync(CatalogContext context, IWebHostEnvironment env, IOptions<CatalogSettings> settings, ILogger<CatalogContextSeed> logger)
{ {
var policy = CreatePolicy(logger, nameof(CatalogContextSeed)); var policy = CreatePolicy(logger, nameof(CatalogContextSeed));
@ -367,5 +367,4 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure
} }
); );
} }
}
} }

View File

@ -1,8 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations;
{
class CatalogBrandEntityTypeConfiguration class CatalogBrandEntityTypeConfiguration
: IEntityTypeConfiguration<CatalogBrand> : IEntityTypeConfiguration<CatalogBrand>
{ {
public void Configure(EntityTypeBuilder<CatalogBrand> builder) public void Configure(EntityTypeBuilder<CatalogBrand> builder)
{ {
builder.ToTable("CatalogBrand"); builder.ToTable("CatalogBrand");
@ -17,5 +17,4 @@
.IsRequired() .IsRequired()
.HasMaxLength(100); .HasMaxLength(100);
} }
}
} }

View File

@ -1,8 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations;
{
class CatalogItemEntityTypeConfiguration class CatalogItemEntityTypeConfiguration
: IEntityTypeConfiguration<CatalogItem> : IEntityTypeConfiguration<CatalogItem>
{ {
public void Configure(EntityTypeBuilder<CatalogItem> builder) public void Configure(EntityTypeBuilder<CatalogItem> builder)
{ {
builder.ToTable("Catalog"); builder.ToTable("Catalog");
@ -31,5 +31,4 @@
.WithMany() .WithMany()
.HasForeignKey(ci => ci.CatalogTypeId); .HasForeignKey(ci => ci.CatalogTypeId);
} }
}
} }

View File

@ -1,8 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.EntityConfigurations;
{
class CatalogTypeEntityTypeConfiguration class CatalogTypeEntityTypeConfiguration
: IEntityTypeConfiguration<CatalogType> : IEntityTypeConfiguration<CatalogType>
{ {
public void Configure(EntityTypeBuilder<CatalogType> builder) public void Configure(EntityTypeBuilder<CatalogType> builder)
{ {
builder.ToTable("CatalogType"); builder.ToTable("CatalogType");
@ -17,5 +17,4 @@
.IsRequired() .IsRequired()
.HasMaxLength(100); .HasMaxLength(100);
} }
}
} }

View File

@ -1,10 +1,10 @@
namespace Catalog.API.Infrastructure.Exceptions namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Exceptions;
/// <summary>
/// Exception type for app exceptions
/// </summary>
public class CatalogDomainException : Exception
{ {
/// <summary>
/// Exception type for app exceptions
/// </summary>
public class CatalogDomainException : Exception
{
public CatalogDomainException() public CatalogDomainException()
{ } { }
@ -15,5 +15,4 @@
public CatalogDomainException(string message, Exception innerException) public CatalogDomainException(string message, Exception innerException)
: base(message, innerException) : base(message, innerException)
{ } { }
}
} }

View File

@ -1,7 +1,7 @@
namespace Catalog.API.Infrastructure.Filters namespace Microsoft.eShopOnContainers.Services.Catalog.API.Infrastructure.Filters;
public class HttpGlobalExceptionFilter : IExceptionFilter
{ {
public class HttpGlobalExceptionFilter : IExceptionFilter
{
private readonly IWebHostEnvironment env; private readonly IWebHostEnvironment env;
private readonly ILogger<HttpGlobalExceptionFilter> logger; private readonly ILogger<HttpGlobalExceptionFilter> logger;
@ -55,5 +55,4 @@
public object DeveloperMessage { get; set; } public object DeveloperMessage { get; set; }
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Catalog.API.IntegrationEvents namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents;
public class CatalogIntegrationEventService : ICatalogIntegrationEventService, IDisposable
{ {
public class CatalogIntegrationEventService : ICatalogIntegrationEventService, IDisposable
{
private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory; private readonly Func<DbConnection, IIntegrationEventLogService> _integrationEventLogServiceFactory;
private readonly IEventBus _eventBus; private readonly IEventBus _eventBus;
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
@ -71,5 +71,4 @@
Dispose(disposing: true); Dispose(disposing: true);
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
} }
}
} }

View File

@ -1,9 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling;
{
public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler : public class OrderStatusChangedToAwaitingValidationIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent> IIntegrationEventHandler<OrderStatusChangedToAwaitingValidationIntegrationEvent>
{ {
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
private readonly ICatalogIntegrationEventService _catalogIntegrationEventService; private readonly ICatalogIntegrationEventService _catalogIntegrationEventService;
private readonly ILogger<OrderStatusChangedToAwaitingValidationIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToAwaitingValidationIntegrationEventHandler> _logger;
@ -44,5 +43,4 @@
} }
} }
}
} }

View File

@ -1,8 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.EventHandling;
{
public class OrderStatusChangedToPaidIntegrationEventHandler : public class OrderStatusChangedToPaidIntegrationEventHandler :
IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent> IIntegrationEventHandler<OrderStatusChangedToPaidIntegrationEvent>
{ {
private readonly CatalogContext _catalogContext; private readonly CatalogContext _catalogContext;
private readonly ILogger<OrderStatusChangedToPaidIntegrationEventHandler> _logger; private readonly ILogger<OrderStatusChangedToPaidIntegrationEventHandler> _logger;
@ -32,5 +32,4 @@
} }
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{ {
public record OrderStatusChangedToAwaitingValidationIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public IEnumerable<OrderStockItem> OrderStockItems { get; } public IEnumerable<OrderStockItem> OrderStockItems { get; }
@ -11,10 +11,10 @@
OrderId = orderId; OrderId = orderId;
OrderStockItems = orderStockItems; OrderStockItems = orderStockItems;
} }
} }
public record OrderStockItem public record OrderStockItem
{ {
public int ProductId { get; } public int ProductId { get; }
public int Units { get; } public int Units { get; }
@ -23,5 +23,4 @@
ProductId = productId; ProductId = productId;
Units = units; Units = units;
} }
}
} }

View File

@ -1,10 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
{
using Microsoft.eShopOnContainers.BuildingBlocks.EventBus.Events;
using System.Collections.Generic;
public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent public record OrderStatusChangedToPaidIntegrationEvent : IntegrationEvent
{ {
public int OrderId { get; } public int OrderId { get; }
public IEnumerable<OrderStockItem> OrderStockItems { get; } public IEnumerable<OrderStockItem> OrderStockItems { get; }
@ -14,5 +11,4 @@
OrderId = orderId; OrderId = orderId;
OrderStockItems = orderStockItems; OrderStockItems = orderStockItems;
} }
}
} }

View File

@ -1,9 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
{ {
public record OrderStockConfirmedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public OrderStockConfirmedIntegrationEvent(int orderId) => OrderId = orderId; public OrderStockConfirmedIntegrationEvent(int orderId) => OrderId = orderId;
}
} }

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
{ {
public record OrderStockRejectedIntegrationEvent : IntegrationEvent
{
public int OrderId { get; } public int OrderId { get; }
public List<ConfirmedOrderStockItem> OrderStockItems { get; } public List<ConfirmedOrderStockItem> OrderStockItems { get; }
@ -12,10 +12,10 @@
OrderId = orderId; OrderId = orderId;
OrderStockItems = orderStockItems; OrderStockItems = orderStockItems;
} }
} }
public record ConfirmedOrderStockItem public record ConfirmedOrderStockItem
{ {
public int ProductId { get; } public int ProductId { get; }
public bool HasStock { get; } public bool HasStock { get; }
@ -24,5 +24,4 @@
ProductId = productId; ProductId = productId;
HasStock = hasStock; HasStock = hasStock;
} }
}
} }

View File

@ -1,10 +1,10 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents.Events;
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be past tense
// An Integration Event is an event that can cause side effects to other microservices, Bounded-Contexts or external systems.
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{ {
// Integration Events notes:
// An Event is “something that has happened in the past”, therefore its name has to be past tense
// An Integration Event is an event that can cause side effects to other microservices, Bounded-Contexts or external systems.
public record ProductPriceChangedIntegrationEvent : IntegrationEvent
{
public int ProductId { get; private init; } public int ProductId { get; private init; }
public decimal NewPrice { get; private init; } public decimal NewPrice { get; private init; }
@ -17,5 +17,4 @@
NewPrice = newPrice; NewPrice = newPrice;
OldPrice = oldPrice; OldPrice = oldPrice;
} }
}
} }

View File

@ -1,8 +1,7 @@
namespace Catalog.API.IntegrationEvents namespace Microsoft.eShopOnContainers.Services.Catalog.API.IntegrationEvents;
public interface ICatalogIntegrationEventService
{ {
public interface ICatalogIntegrationEventService
{
Task SaveEventAndCatalogContextChangesAsync(IntegrationEvent evt); Task SaveEventAndCatalogContextChangesAsync(IntegrationEvent evt);
Task PublishThroughEventBusAsync(IntegrationEvent evt); Task PublishThroughEventBusAsync(IntegrationEvent evt);
}
} }

View File

@ -1,9 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model;
public class CatalogBrand
{ {
public class CatalogBrand
{
public int Id { get; set; } public int Id { get; set; }
public string Brand { get; set; } public string Brand { get; set; }
}
} }

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model;
public class CatalogItem
{ {
public class CatalogItem
{
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } public string Name { get; set; }
@ -96,5 +96,4 @@
return this.AvailableStock - original; return this.AvailableStock - original;
} }
}
} }

View File

@ -1,9 +1,8 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model namespace Microsoft.eShopOnContainers.Services.Catalog.API.Model;
public class CatalogType
{ {
public class CatalogType
{
public int Id { get; set; } public int Id { get; set; }
public string Type { get; set; } public string Type { get; set; }
}
} }

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API namespace Microsoft.eShopOnContainers.Services.Catalog.API;
public class Startup
{ {
public class Startup
{
public Startup(IConfiguration configuration) public Startup(IConfiguration configuration)
{ {
Configuration = configuration; Configuration = configuration;
@ -89,10 +89,10 @@
eventBus.Subscribe<OrderStatusChangedToAwaitingValidationIntegrationEvent, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>(); eventBus.Subscribe<OrderStatusChangedToAwaitingValidationIntegrationEvent, OrderStatusChangedToAwaitingValidationIntegrationEventHandler>();
eventBus.Subscribe<OrderStatusChangedToPaidIntegrationEvent, OrderStatusChangedToPaidIntegrationEventHandler>(); eventBus.Subscribe<OrderStatusChangedToPaidIntegrationEvent, OrderStatusChangedToPaidIntegrationEventHandler>();
} }
} }
public static class CustomExtensionMethods public static class CustomExtensionMethods
{ {
public static IServiceCollection AddAppInsight(this IServiceCollection services, IConfiguration configuration) public static IServiceCollection AddAppInsight(this IServiceCollection services, IConfiguration configuration)
{ {
services.AddApplicationInsightsTelemetry(configuration); services.AddApplicationInsightsTelemetry(configuration);
@ -330,5 +330,4 @@
return services; return services;
} }
}
} }

View File

@ -1,7 +1,7 @@
namespace Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel namespace Microsoft.eShopOnContainers.Services.Catalog.API.ViewModel;
public class PaginatedItemsViewModel<TEntity> where TEntity : class
{ {
public class PaginatedItemsViewModel<TEntity> where TEntity : class
{
public int PageIndex { get; private set; } public int PageIndex { get; private set; }
public int PageSize { get; private set; } public int PageSize { get; private set; }
@ -17,5 +17,4 @@
Count = count; Count = count;
Data = data; Data = data;
} }
}
} }