Sealed qualifying public classes Migrated database changes
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using LiteCharms.Features.MidrandBooks.AuthorBooks.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Authors.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Customers.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Orders.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Pages.Models;
|
||||
using LiteCharms.Features.MidrandBooks.Products.Models;
|
||||
|
||||
@@ -8,6 +9,50 @@ namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||
|
||||
public static class Mappers
|
||||
{
|
||||
public static ShippingProvider ToModel(this Orders.Entities.ShippingProvider entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
Name = entity.Name,
|
||||
Type = entity.Type,
|
||||
Price = entity.Price,
|
||||
Enabled = entity.Enabled
|
||||
};
|
||||
|
||||
public static Shipping ToModel(this Orders.Entities.Shipping entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
OrderId = entity.OrderId,
|
||||
AddressId = entity.AddressId,
|
||||
Status = entity.Status,
|
||||
TrackingNumber = entity.TrackingNumber
|
||||
};
|
||||
|
||||
public static OrderItem ToModel(this Orders.Entities.OrderItem entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
OrderId = entity.OrderId,
|
||||
Quantity = entity.Quantity,
|
||||
AuthorBookId = entity.AuthorBookId,
|
||||
ProductPriceId = entity.ProductPriceId
|
||||
};
|
||||
|
||||
public static Order ToModel(this Orders.Entities.Order entity) => new()
|
||||
{
|
||||
Id = entity.Id,
|
||||
CustomerId = entity.CustomerId,
|
||||
CreatedAt = entity.CreatedAt,
|
||||
UpdatedAt = entity.UpdatedAt,
|
||||
Status = entity.Status,
|
||||
Total = entity.Total,
|
||||
InvoiceUrl = entity.InvoiceUrl,
|
||||
Notes = entity.Notes
|
||||
};
|
||||
|
||||
public static Customer ToModel(this Customers.Entities.Customer entiry) => new()
|
||||
{
|
||||
Id = entiry.Id,
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using LiteCharms.Features.MidrandBooks.Abstractions;
|
||||
|
||||
namespace LiteCharms.Features.MidrandBooks.Extensions;
|
||||
|
||||
public static class Shop
|
||||
{
|
||||
public static IServiceCollection AddShopServices(this IServiceCollection services, Assembly assembly, ServiceLifetime serviceLifetime)
|
||||
{
|
||||
var serviceType = typeof(IService);
|
||||
|
||||
var implementations = assembly.GetTypes()
|
||||
.Where(t => serviceType.IsAssignableFrom(t) && t.IsClass && !t.IsAbstract);
|
||||
|
||||
foreach (var implementation in implementations)
|
||||
{
|
||||
var descriptor = new ServiceDescriptor(serviceType, implementation, serviceLifetime);
|
||||
|
||||
services.Add(descriptor);
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user