Compare commits

..

3 Commits

Author SHA1 Message Date
Amir Hossein Khademi d442ed17ee feat : products , ordering system , discount
add discount page and CRUD , complete products CRUD , improve ordering system
2024-02-09 19:43:17 +03:30
Amir Hossein Khademi 70e667468d edit products and ordering 2024-02-08 18:56:56 +03:30
Amir Hossein Khademi 5355d416bf chore : update dependencies 2024-02-07 01:12:05 +03:30
59 changed files with 10047 additions and 341 deletions

View File

@ -14,11 +14,11 @@ public class OrderBagController : ICarterModule
.WithDisplayName("GetUserCurrentOrderBagAsync") .WithDisplayName("GetUserCurrentOrderBagAsync")
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapPost("add/{productId}", AddProductToBagAsync) group.MapPost("add", AddProductToBagAsync)
.WithDisplayName("AddProductToBag") .WithDisplayName("AddProductToBag")
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapPost("remove/{productId}", RemoveFromOrderBagAsync) group.MapDelete("remove", RemoveFromOrderBagAsync)
.WithDisplayName("RemoveFromOrderBag") .WithDisplayName("RemoveFromOrderBag")
.HasApiVersion(1.0); .HasApiVersion(1.0);
@ -40,12 +40,12 @@ public class OrderBagController : ICarterModule
public async Task<IResult> GetUserCurrentOrderBagAsync(IMediator mediator, CancellationToken cancellationToken) public async Task<IResult> GetUserCurrentOrderBagAsync(IMediator mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new GetUserOrderBagQuery(), cancellationToken)); => TypedResults.Ok(await mediator.Send(new GetUserOrderBagQuery(), cancellationToken));
public async Task<IResult> AddProductToBagAsync( Guid productId, [FromQuery]int count, IMediator mediator, CancellationToken cancellationToken) public async Task<IResult> AddProductToBagAsync([FromBody] List<OrderBagRequestDto> requestDtos, IMediator mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new AddToOrderBagCommand(productId,count), cancellationToken)); => TypedResults.Ok(await mediator.Send(new AddToOrderBagCommand(requestDtos), cancellationToken));
public async Task<IResult> RemoveFromOrderBagAsync(Guid productId, [FromQuery] int count, IMediator mediator, CancellationToken cancellationToken) public async Task<IResult> RemoveFromOrderBagAsync([FromBody] List<OrderBagRequestDto> requestDtos, IMediator mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new RemoveFromOrderBagCommand(productId, count), cancellationToken)); => TypedResults.Ok(await mediator.Send(new RemoveFromOrderBagCommand(requestDtos), cancellationToken));
public async Task<IResult> AddDiscountToOrderBagAsync(Guid orderId, [FromQuery] string discountCode, IMediator mediator, CancellationToken cancellationToken) public async Task<IResult> AddDiscountToOrderBagAsync(Guid orderId, [FromQuery] string discountCode, IMediator mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new SubmitDiscountCommand(orderId, discountCode), cancellationToken)); => TypedResults.Ok(await mediator.Send(new SubmitDiscountCommand(orderId, discountCode), cancellationToken));

View File

@ -32,8 +32,8 @@ public class ProductController : ICarterModule
} }
// GET:Get All Entity // GET:Get All Entity
public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery]string? productName, [FromQuery] QuerySortBy? sortBy,[FromQuery] Guid? categoryId , [FromQuery] Guid[]? brandIds , [FromQuery]double? minPrice , [FromQuery] double? maxPrice, [FromQuery]bool? isActive, IMediator mediator, CancellationToken cancellationToken) public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery]string? productName, [FromQuery] QuerySortBy? sortBy, [FromQuery] Guid? categoryId, [FromQuery] bool? specialOffer, [FromQuery] Guid[]? brandIds , [FromQuery]double? minPrice , [FromQuery] double? maxPrice, [FromQuery]bool? isActive, IMediator mediator, CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new GetProductsQuery(Page: page,SortBy: sortBy ?? 0 ,ProductName: productName, CategoryId: categoryId ?? default , BrandIds: brandIds , MinPrice: minPrice ?? -1 , MaxPrice:maxPrice ?? 0,IsActive:isActive),cancellationToken)); => TypedResults.Ok(await mediator.Send(new GetProductsQuery(Page: page, SpecialOffer: specialOffer, SortBy: sortBy ?? 0 ,ProductName: productName, CategoryId: categoryId ?? default , BrandIds: brandIds , MinPrice: minPrice ?? -1 , MaxPrice:maxPrice ?? 0,IsActive:isActive),cancellationToken));
// GET:Get An Entity By Id // GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, IMediator mediator,CancellationToken cancellationToken) public async Task<IResult> GetAsync(Guid id, IMediator mediator,CancellationToken cancellationToken)

View File

@ -0,0 +1,59 @@
using NetinaShop.Core.EntityServices.Abstracts;
namespace NetinaShop.Api.Controller;
public class RoleController : ICarterModule
{
public void AddRoutes(IEndpointRouteBuilder app)
{
var group = app.NewVersionedApi("Roles")
.MapGroup($"api/user/role")
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
group.MapGet("", GetAllAsync)
.WithDisplayName("GetAllRoles")
.HasApiVersion(1.0);
group.MapGet("permission", GetAllPermissions)
.WithDisplayName("GetAllPermissions")
.HasApiVersion(1.0);
group.MapGet("{id}", GetAsync)
.WithDisplayName("GetRole")
.HasApiVersion(1.0);
group.MapPost("", Post)
.HasApiVersion(1.0);
group.MapPut("", Put)
.HasApiVersion(1.0);
group.MapDelete("{id}", Delete)
.HasApiVersion(1.0);
}
// GET:Get All Entity
public async Task<IResult> GetAllAsync([FromQuery] int? page, [FromQuery]string? roleName, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.GetRolesAsync(page,roleName, cancellationToken));
// GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.GetRoleAsync(id, cancellationToken));
// POST:Create Entity
public async Task<IResult> Post([FromBody] RoleActionRequestDto request, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.CreateRoleAsync(request, cancellationToken));
// PUT:Update Entity
public async Task<IResult> Put([FromBody] RoleActionRequestDto request, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.EditRoleAsync(request, cancellationToken));
// DELETE:Delete Entity
public async Task<IResult> Delete(Guid id, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.RemoveRoleAsync(id, cancellationToken));
// DELETE:Delete Entity
public async Task<IResult> GetAllPermissions(IUserService userService)
=> TypedResults.Ok(userService.GetPermissions());
}

View File

@ -0,0 +1,52 @@

using NetinaShop.Core.EntityServices.Abstracts;
namespace NetinaShop.Api.Controller;
public class UserController : ICarterModule
{
public void AddRoutes(IEndpointRouteBuilder app)
{
var group = app.NewVersionedApi("Users")
.MapGroup($"api/user")
.RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser());
group.MapGet("", GetAllAsync)
.WithDisplayName("GetAllUsers")
.HasApiVersion(1.0);
group.MapGet("{id}", GetAsync)
.WithDisplayName("GetUser")
.HasApiVersion(1.0);
group.MapPost("", Post)
.HasApiVersion(1.0);
group.MapPut("", Put)
.HasApiVersion(1.0);
group.MapDelete("{id}", Delete)
.HasApiVersion(1.0);
}
// GET:Get All Entity
public async Task<IResult> GetAllAsync([FromQuery] int page, [FromQuery]string? phoneNumber, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.GetUsersAsync(page,phoneNumber,cancellationToken));
// GET:Get An Entity By Id
public async Task<IResult> GetAsync(Guid id, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.GetUserAsync(id,cancellationToken));
// POST:Create Entity
public async Task<IResult> Post([FromBody] UserActionRequestDto request, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.CreateUserAsync(request,cancellationToken));
// PUT:Update Entity
public async Task<IResult> Put([FromBody] UserActionRequestDto request, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.EditUserAsync(request,cancellationToken));
// DELETE:Delete Entity
public async Task<IResult> Delete(Guid id, IUserService userService, CancellationToken cancellationToken)
=> TypedResults.Ok(await userService.RemoveUserAsync(id,cancellationToken));
}

View File

@ -11,49 +11,49 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageReference Include="Asp.Versioning.Http" Version="8.0.0" /> <PackageReference Include="Asp.Versioning.Http" Version="8.0.0" />
<PackageReference Include="Ben.BlockingDetector" Version="0.0.4" /> <PackageReference Include="Ben.BlockingDetector" Version="0.0.4" />
<PackageReference Include="Carter" Version="8.0.0" /> <PackageReference Include="Carter" Version="8.0.0" />
<PackageReference Include="FluentValidation" Version="11.8.1" /> <PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.1" /> <PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="11.3.0" /> <PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Autofac" Version="7.1.0" /> <PackageReference Include="Autofac" Version="8.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" /> <PackageReference Include="Autofac.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.0.17" /> <PackageReference Include="Elmah.Io.AspNetCore.Serilog" Version="5.0.17" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" /> <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.6" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.0" />
<PackageReference Include="Sentry.Serilog" Version="3.41.3" /> <PackageReference Include="Sentry.Serilog" Version="4.0.1" />
<PackageReference Include="Serilog" Version="3.1.1" /> <PackageReference Include="Serilog" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" /> <PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" /> <PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" /> <PackageReference Include="Serilog.Sinks.PostgreSQL" Version="2.3.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" /> <PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.0.38" /> <PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.0.38" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" /> <PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" /> <PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" /> <PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="9.1.0" /> <PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" /> <PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.12" /> <PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.0" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.Drawing.Common" Version="8.0.0" /> <PackageReference Include="System.Drawing.Common" Version="8.0.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -73,6 +73,11 @@ builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
.WithAllOpenGenericHandlerTypesRegistered() .WithAllOpenGenericHandlerTypesRegistered()
.Build()); .Build());
builder.RegisterMediatR(MediatRConfigurationBuilder
.Create(typeof(CoreConfig).Assembly)
.WithAllOpenGenericHandlerTypesRegistered()
.Build());
builder.RegisterMediatR(MediatRConfigurationBuilder builder.RegisterMediatR(MediatRConfigurationBuilder
.Create(typeof(DomainConfig).Assembly) .Create(typeof(DomainConfig).Assembly)
.WithAllOpenGenericHandlerTypesRegistered() .WithAllOpenGenericHandlerTypesRegistered()

View File

@ -1,4 +1,5 @@
using NetinaShop.Repository.Abstracts; using System.Security.Cryptography;
using NetinaShop.Repository.Abstracts;
namespace NetinaShop.Api.Services; namespace NetinaShop.Api.Services;
@ -14,5 +15,36 @@ public class CurrentUserService : ICurrentUserService
public string? UserId => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier); public string? UserId => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
public string? RoleName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Role); public string? RoleName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Role);
public string? UserName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Name); public string? UserName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Name);
public string? DeviceId => GetDeviceId(_httpContextAccessor.HttpContext);
public bool IsAuthorized => GetAuthorized();
public List<string>? Permissions => _httpContextAccessor.HttpContext?.User?.FindAll("Permission")?.Select(c => c.Value)?.ToList(); public List<string>? Permissions => _httpContextAccessor.HttpContext?.User?.FindAll("Permission")?.Select(c => c.Value)?.ToList();
private string? GetDeviceId(HttpContext? context)
{
if (context?.Request?.Headers == null)
return null;
string? userAgent = context.Request.Headers["User-Agent"];
string? ipAddress = context.Connection.RemoteIpAddress?.ToString();
string? origin = context.Request.Headers["Origin"];
string input = userAgent + "_" + ipAddress;
using SHA256 sha256Hash = SHA256.Create();
byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
StringBuilder builder = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
builder.Append(bytes[i].ToString("x2"));
}
var uniqueId = builder.ToString();
return uniqueId;
}
private bool GetAuthorized()
{
if (_httpContextAccessor.HttpContext?.User.Identity == null)
return false;
return _httpContextAccessor.HttpContext.User.Identity.IsAuthenticated;
}
} }

View File

@ -13,7 +13,7 @@ public static class LoggerConfig
o.MinimumEventLevel = LogEventLevel.Error; o.MinimumEventLevel = LogEventLevel.Error;
o.Dsn = "https://592b7fbb29464442a8e996247abe857f@watcher.igarson.app/7"; o.Dsn = "https://592b7fbb29464442a8e996247abe857f@watcher.igarson.app/7";
}) })
.MinimumLevel.Override("Microsoft.EntityFrameworkCore.Database.Command", LogEventLevel.Warning) .MinimumLevel.Override("Microsoft.EntityFrameworkCore", Serilog.Events.LogEventLevel.Error)
.CreateLogger(); .CreateLogger();
} }
} }

View File

@ -52,6 +52,7 @@ public static class ServiceExtensions
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking); options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
options.UseNpgsql(Configuration.GetConnectionString("Postgres"), b => b.MigrationsAssembly("NetinaShop.Repository")) options.UseNpgsql(Configuration.GetConnectionString("Postgres"), b => b.MigrationsAssembly("NetinaShop.Repository"))
.UseProjectAssembly(typeof(ApplicationUser).Assembly); .UseProjectAssembly(typeof(ApplicationUser).Assembly);
//options.EnableServiceProviderCaching(true); //options.EnableServiceProviderCaching(true);
}).BuildServiceProvider(); }).BuildServiceProvider();
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);

View File

@ -1,4 +1,7 @@
namespace NetinaShop.Api.WebFramework.MiddleWares; using System.Security.Cryptography;
using NetinaShop.Repository.Migrations;
namespace NetinaShop.Api.WebFramework.MiddleWares;
public static class ExceptionHandlerMiddlewareExtensions public static class ExceptionHandlerMiddlewareExtensions
{ {

View File

@ -11,7 +11,7 @@
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" /> <PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.0.3" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
</ItemGroup>--> </ItemGroup>-->
<PropertyGroup> <PropertyGroup>
@ -24,7 +24,7 @@
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" /> <PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.2.0" /> <PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -3,9 +3,9 @@
public interface IUserService : IScopedDependency public interface IUserService : IScopedDependency
{ {
Task<ProfileResponseDto> GetUserProfileAsync(CancellationToken cancellationToken); Task<ProfileResponseDto> GetUserProfileAsync(CancellationToken cancellationToken);
Task<List<ApplicationUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default); Task<List<ApplicationUserSDto>> GetUsersAsync(int page = 0,string? phoneNumber = null, CancellationToken cancellationToken = default);
Task<ApplicationUserSDto> GetUserAsync(Guid userId); Task<ApplicationUserSDto> GetUserAsync(Guid userId, CancellationToken cancellationToken = default);
Task<ApplicationUser> CreateUserAsync(string phoneNumber); Task<ApplicationUser> CreateUserAsync(string phoneNumber, CancellationToken cancellationToken = default);
Task<ApplicationUser> CreateUserAsync(UserActionRequestDto request, CancellationToken cancellationToken); Task<ApplicationUser> CreateUserAsync(UserActionRequestDto request, CancellationToken cancellationToken);
Task<bool> EditUserAsync(UserActionRequestDto request, CancellationToken cancellationToken); Task<bool> EditUserAsync(UserActionRequestDto request, CancellationToken cancellationToken);
Task<bool> EditUserProfileAsync(UserActionRequestDto request, CancellationToken cancellationToken); Task<bool> EditUserProfileAsync(UserActionRequestDto request, CancellationToken cancellationToken);
@ -13,9 +13,10 @@ public interface IUserService : IScopedDependency
Task<List<ApplicationRole>> GetRolesAsync(int page = 0, CancellationToken cancellationToken = default); Task<List<ApplicationRole>> GetRolesAsync(int page = 0, CancellationToken cancellationToken = default);
Task<RoleActionRequestDto> GetRoleAsync(Guid roleId); Task<List<ApplicationRole>> GetRolesAsync(int? page,string? roleName, CancellationToken cancellationToken = default);
Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request); Task<RoleActionRequestDto> GetRoleAsync(Guid roleId, CancellationToken cancellationToken = default);
Task<bool> EditRoleAsync(RoleActionRequestDto request); Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default);
Task<bool> RemoveRoleAsync(Guid roleId); Task<bool> EditRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default);
Task<bool> RemoveRoleAsync(Guid roleId, CancellationToken cancellationToken = default);
List<ClaimDto> GetPermissions(); List<ClaimDto> GetPermissions();
} }

View File

@ -20,18 +20,23 @@ public class AddToOrderBagCommandHandler : IRequestHandler<AddToOrderBagCommand,
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId)) if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
throw new AppException("User id wrong", ApiResultStatusCode.BadRequest); throw new AppException("User id wrong", ApiResultStatusCode.BadRequest);
var product = await _repositoryWrapper.SetRepository<Product>()
.TableNoTracking
.FirstOrDefaultAsync(p => p.Id == request.ProductId, cancellationToken);
if (product == null)
throw new AppException("Product not found ",ApiResultStatusCode.NotFound);
if (!product.IsEnable)
throw new AppException("Product is not enable", ApiResultStatusCode.BadRequest);
var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken); var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken);
orderBag.AddToOrderBag(product, request.Count); foreach (var requestDto in request.RequestDtos)
{
var product = await _repositoryWrapper.SetRepository<Product>()
.TableNoTracking
.FirstOrDefaultAsync(p => p.Id == requestDto.ProductId, cancellationToken);
if (product == null)
throw new AppException("Product not found ", ApiResultStatusCode.NotFound);
if (!product.IsEnable)
throw new AppException("Product is not enable", ApiResultStatusCode.BadRequest);
orderBag.AddToOrderBag(product, requestDto.Count);
}
_repositoryWrapper.SetRepository<Order>().Update(orderBag); _repositoryWrapper.SetRepository<Order>().Update(orderBag);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);

View File

@ -19,18 +19,22 @@ public class RemoveFromOrderBagCommandHandler : IRequestHandler<RemoveFromOrderB
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId)) if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
throw new AppException("User id wrong", ApiResultStatusCode.BadRequest); throw new AppException("User id wrong", ApiResultStatusCode.BadRequest);
var product = await _repositoryWrapper.SetRepository<Product>()
.TableNoTracking
.FirstOrDefaultAsync(p => p.Id == request.ProductId, cancellationToken);
if (product == null)
throw new AppException("Product not found ", ApiResultStatusCode.NotFound);
if (!product.IsEnable)
throw new AppException("Product is not enable", ApiResultStatusCode.BadRequest);
var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken); var orderBag = await _mediator.Send(new GetUserOrderBagQuery(), cancellationToken);
orderBag.RemoveFromOrderBag(product, request.Count); foreach (var requestDto in request.RequestDtos)
{
var product = await _repositoryWrapper.SetRepository<Product>()
.TableNoTracking
.FirstOrDefaultAsync(p => p.Id == requestDto.ProductId, cancellationToken);
if (product == null)
throw new AppException("Product not found ", ApiResultStatusCode.NotFound);
if (!product.IsEnable)
throw new AppException("Product is not enable", ApiResultStatusCode.BadRequest);
orderBag.RemoveFromOrderBag(product, requestDto.Count);
}
_repositoryWrapper.SetRepository<Order>().Update(orderBag); _repositoryWrapper.SetRepository<Order>().Update(orderBag);

View File

@ -1,4 +1,8 @@
namespace NetinaShop.Core.EntityServices; using StackExchange.Redis;
using System.Linq;
using System.Security.Claims;
namespace NetinaShop.Core.EntityServices;
public class UserService : IUserService public class UserService : IUserService
@ -52,14 +56,37 @@ public class UserService : IUserService
return response; return response;
} }
public async Task<List<ApplicationUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default) public async Task<List<ApplicationUserSDto>> GetUsersAsync(int page = 0, string? phoneNumber = null, CancellationToken cancellationToken = default)
{ {
var users = await _userManager.Users.Skip(page * 15).Take(15).Select(ApplicationUserMapper.ProjectToSDto).ToListAsync(cancellationToken); List<ApplicationUserSDto> users;
if (phoneNumber == null || phoneNumber.IsNullOrEmpty())
users = await _userManager.Users
.Where(u=>u.UserName!= "09214802813")
.Skip(page * 15).Take(15)
.Select(ApplicationUserMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
else
users = await _userManager.Users
.Where(a => a.PhoneNumber == phoneNumber && a.UserName!= "09214802813")
.Skip(page * 15).Take(15)
.Select(ApplicationUserMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
foreach (var user in users)
{
var roles = await _userManager.GetRolesAsync(user.AdaptToApplicationUser());
foreach (var roleName in roles)
{
var role = await _roleManager.FindByNameAsync(roleName);
if (role != null)
user.RoleName += role.PersianName + " ";
}
}
return users; return users;
} }
public async Task<ApplicationUserSDto> GetUserAsync(Guid userId) public async Task<ApplicationUserSDto> GetUserAsync(Guid userId, CancellationToken cancellationToken = default)
{ {
var user = await _userManager.FindByIdAsync(userId.ToString()); var user = await _userManager.FindByIdAsync(userId.ToString());
if (user == null) if (user == null)
@ -75,7 +102,7 @@ public class UserService : IUserService
return dto; return dto;
} }
public async Task<ApplicationUser> CreateUserAsync(string phoneNumber) public async Task<ApplicationUser> CreateUserAsync(string phoneNumber, CancellationToken cancellationToken = default)
{ {
var user = new ApplicationUser var user = new ApplicationUser
{ {
@ -120,6 +147,16 @@ public class UserService : IUserService
if (!result.Succeeded) if (!result.Succeeded)
throw new AppException(string.Join('|', result.Errors.Select(e => e.Description))); throw new AppException(string.Join('|', result.Errors.Select(e => e.Description)));
} }
if (request.RoleIds.Count > 0)
{
foreach (var roleId in request.RoleIds)
{
var role = await _roleManager.FindByIdAsync(roleId.ToString());
if (role is { Name: not null })
await _userManager.AddToRoleAsync(user, role.Name);
}
}
} }
return user; return user;
} }
@ -155,6 +192,20 @@ public class UserService : IUserService
throw new AppException(string.Join('|', addPassResult.Errors.Select(e => e.Description))); throw new AppException(string.Join('|', addPassResult.Errors.Select(e => e.Description)));
} }
if (request.RoleIds.Count > 0)
{
var userRoles = await _userManager.GetRolesAsync(user);
await _userManager.RemoveFromRolesAsync(user, userRoles);
foreach (var roleId in request.RoleIds)
{
var role = await _roleManager.FindByIdAsync(roleId.ToString());
if (role is { Name: not null })
{
await _userManager.AddToRoleAsync(user, role.Name);
}
}
}
return true; return true;
} }
@ -211,13 +262,28 @@ public class UserService : IUserService
public async Task<List<ApplicationRole>> GetRolesAsync(int page = 0, CancellationToken cancellationToken = default) public async Task<List<ApplicationRole>> GetRolesAsync(int page = 0, CancellationToken cancellationToken = default)
{ {
var roles = await _roleManager.Roles var roles = await _roleManager.Roles
.Where(r=>r.Name != "RootAdmin")
.Skip(page * 15) .Skip(page * 15)
.Take(15) .Take(15)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
return roles; return roles;
} }
public async Task<RoleActionRequestDto> GetRoleAsync(Guid roleId) public async Task<List<ApplicationRole>> GetRolesAsync(int? page, string? roleName, CancellationToken cancellationToken = default)
{
IQueryable<ApplicationRole> roles;
if (roleName!=null)
roles = _roleManager.Roles.Where(r => r.Name != "RootAdmin" && r.PersianName.Trim().ToLower().Contains(roleName));
else
roles = _roleManager.Roles.Where(r => r.Name != "RootAdmin");
if (page != null)
roles = roles.Skip(page.Value * 15).Take(15);
else
roles = roles;
return await roles.ToListAsync(cancellationToken);
}
public async Task<RoleActionRequestDto> GetRoleAsync(Guid roleId, CancellationToken cancellationToken = default)
{ {
var role = (await _roleManager.FindByIdAsync(roleId.ToString())); var role = (await _roleManager.FindByIdAsync(roleId.ToString()));
if (role == null) if (role == null)
@ -233,7 +299,7 @@ public class UserService : IUserService
return roleDto; return roleDto;
} }
public async Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request) public async Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default)
{ {
if (request.EnglishName.IsNullOrEmpty()) if (request.EnglishName.IsNullOrEmpty())
throw new AppException("لطفا نام انگلیسی را وارد کنید"); throw new AppException("لطفا نام انگلیسی را وارد کنید");
@ -253,7 +319,7 @@ public class UserService : IUserService
return applicationRole; return applicationRole;
} }
public async Task<bool> EditRoleAsync(RoleActionRequestDto request) public async Task<bool> EditRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default)
{ {
if (request.EnglishName.IsNullOrEmpty()) if (request.EnglishName.IsNullOrEmpty())
throw new AppException("لطفا نام انگلیسی را وارد کنید"); throw new AppException("لطفا نام انگلیسی را وارد کنید");
@ -272,23 +338,21 @@ public class UserService : IUserService
var roleClaims = (await _roleManager.GetClaimsAsync(applicationRole)).Where(c => c.Type == CustomClaimType.Permission).ToList(); var roleClaims = (await _roleManager.GetClaimsAsync(applicationRole)).Where(c => c.Type == CustomClaimType.Permission).ToList();
foreach (var roleClaim in roleClaims.ToList()) foreach (var roleClaim in roleClaims.ToList())
{ {
if (request.Permissions.Contains(roleClaim.Value)) await _roleManager.RemoveClaimAsync(applicationRole,roleClaim);
{ //if (request.Permissions.Contains(roleClaim.Value))
roleClaims.Remove(roleClaim); //{
request.Permissions.Remove(roleClaim.Value); // roleClaims.Remove(roleClaim);
} // request.Permissions.Remove(roleClaim.Value);
//}
} }
foreach (var claim in request.Permissions) foreach (var claim in request.Permissions)
await _roleManager.AddClaimAsync(applicationRole, new Claim(CustomClaimType.Permission, claim)); await _roleManager.AddClaimAsync(applicationRole, new Claim(CustomClaimType.Permission, claim));
foreach (var claim in roleClaims)
await _roleManager.RemoveClaimAsync(applicationRole, claim);
return true; return true;
} }
public async Task<bool> RemoveRoleAsync(Guid roleId) public async Task<bool> RemoveRoleAsync(Guid roleId, CancellationToken cancellationToken = default)
{ {
var applicationRole = await _roleManager.FindByIdAsync(roleId.ToString()); var applicationRole = await _roleManager.FindByIdAsync(roleId.ToString());
if (applicationRole == null) if (applicationRole == null)

View File

@ -12,7 +12,7 @@
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" /> <PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
<PackageReference Include="Autofac.Extras.Quartz" Version="9.0.0" /> <PackageReference Include="Autofac.Extras.Quartz" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.0" /> <PackageReference Include="SixLabors.ImageSharp" Version="3.1.2" />
<PackageReference Include="Quartz" Version="3.8.0" /> <PackageReference Include="Quartz" Version="3.8.0" />
</ItemGroup> </ItemGroup>

View File

@ -1,9 +1,11 @@
namespace NetinaShop.Domain.CommandQueries.Commands; using NetinaShop.Domain.Entities.Products;
namespace NetinaShop.Domain.CommandQueries.Commands;
public sealed record CreateOrderCommand(string DiscountCode, List<OrderProductSDto> OrderProducts, OrderDeliverySDto OrderDelivery) : IRequest<OrderSDto>; public sealed record CreateOrderCommand(string DiscountCode, List<OrderProductSDto> OrderProducts, OrderDeliverySDto OrderDelivery) : IRequest<OrderSDto>;
public sealed record AddToOrderBagCommand(Guid ProductId, int Count) : IRequest<bool>; public sealed record AddToOrderBagCommand(List<OrderBagRequestDto> RequestDtos) : IRequest<bool>;
public sealed record RemoveFromOrderBagCommand(Guid ProductId, int Count) : IRequest<bool>; public sealed record RemoveFromOrderBagCommand(List<OrderBagRequestDto> RequestDtos) : IRequest<bool>;
public sealed record SubmitDiscountCommand(Guid OrderId,string DiscountCode) : IRequest<bool>; public sealed record SubmitDiscountCommand(Guid OrderId,string DiscountCode) : IRequest<bool>;
public sealed record SubmitOrderDeliveryCommand(string Address, string PostalCode, string ReceiverPhoneNumber, string ReceiverFullName, Guid OrderId, Guid ShippingId) : IRequest<bool>; public sealed record SubmitOrderDeliveryCommand(string Address, string PostalCode, string ReceiverPhoneNumber, string ReceiverFullName, Guid OrderId, Guid ShippingId) : IRequest<bool>;

View File

@ -10,6 +10,7 @@ string Warranty,
bool BeDisplayed, bool BeDisplayed,
double Cost, double Cost,
double PackingCost, double PackingCost,
int Stock,
bool HasExpressDelivery, bool HasExpressDelivery,
int MaxOrderCount, int MaxOrderCount,
bool IsSpecialOffer, bool IsSpecialOffer,
@ -30,6 +31,7 @@ public sealed record UpdateProductCommand(
bool BeDisplayed, bool BeDisplayed,
double Cost, double Cost,
double PackingCost, double PackingCost,
int Stock,
bool HasExpressDelivery, bool HasExpressDelivery,
int MaxOrderCount, int MaxOrderCount,
bool IsSpecialOffer, bool IsSpecialOffer,

View File

@ -5,6 +5,7 @@ public sealed record GetProductQuery(Guid Id) : IRequest<ProductLDto>;
public sealed record GetProductsQuery( public sealed record GetProductsQuery(
Guid[]? BrandIds, Guid[]? BrandIds,
bool? IsActive, bool? IsActive,
bool? SpecialOffer,
int Page = 0 , int Page = 0 ,
string? ProductName = default, string? ProductName = default,
QuerySortBy SortBy = QuerySortBy.None , QuerySortBy SortBy = QuerySortBy.None ,

View File

@ -13,6 +13,7 @@ public class ProductLDto : BaseDto<ProductLDto,Product>
public int MaxOrderCount { get; set; } public int MaxOrderCount { get; set; }
public double Cost { get; set; } public double Cost { get; set; }
public double PackingCost { get; set; } public double PackingCost { get; set; }
public int Stock { get; set; }
public Guid BrandId { get; set; } public Guid BrandId { get; set; }
public string BrandName { get; set; } = string.Empty; public string BrandName { get; set; } = string.Empty;
public Guid CategoryId { get; set; } public Guid CategoryId { get; set; }

View File

@ -0,0 +1,7 @@
namespace NetinaShop.Domain.Dtos.RequestDtos;
public class OrderBagRequestDto
{
public Guid ProductId { get; set; }
public int Count { get; set; }
}

View File

@ -20,9 +20,10 @@ public class ProductSDto : BaseDto<ProductSDto, Product>
public float Rate { get; set; } public float Rate { get; set; }
public int ReviewCount { get; set; } public int ReviewCount { get; set; }
public int Viewed { get; set; } public int Viewed { get; set; }
public string MainImage { get; set; } = string.Empty;
public Guid CategoryId { get; internal set; } public Guid CategoryId { get; internal set; }
public Guid BrandId { get; set; } public Guid BrandId { get; set; }
public string BrandNames { get; set; } = string.Empty; public string BrandName { get; set; } = string.Empty;
public string CategoryName { get; set; } = string.Empty; public string CategoryName { get; set; } = string.Empty;
} }

View File

@ -7,11 +7,27 @@ public partial class Product
double cost, double cost,
double packingCost, double packingCost,
bool hasExpressDelivery, bool hasExpressDelivery,
int stock,
int maxOrderCount, int maxOrderCount,
Guid brandId, Guid brandId,
Guid categoryId) Guid categoryId)
{ {
return new Product(persianName, englishName, summery, expertCheck, tags, warranty, beDisplayed,cost, packingCost,hasExpressDelivery,maxOrderCount, brandId,categoryId); return new Product(
persianName,
englishName,
summery,
expertCheck,
tags,
warranty,
beDisplayed,
cost,
packingCost,
stock,
hasExpressDelivery,
maxOrderCount,
stock > 0,
brandId,
categoryId);
} }
public void AddRate(float rate) public void AddRate(float rate)

View File

@ -1,9 +1,11 @@
using NetinaShop.Domain.Entities.ProductCategories; using System.ComponentModel.DataAnnotations.Schema;
using NetinaShop.Domain.Entities.ProductCategories;
namespace NetinaShop.Domain.Entities.Products; namespace NetinaShop.Domain.Entities.Products;
[AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget )]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
//[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
[GenerateMapper] [GenerateMapper]
public partial class Product : ApiEntity public partial class Product : ApiEntity
{ {
@ -21,8 +23,10 @@ public partial class Product : ApiEntity
bool beDisplayed, bool beDisplayed,
double cost, double cost,
double packingCost, double packingCost,
int stock,
bool hasExpressDelivery, bool hasExpressDelivery,
int maxOrderCount, int maxOrderCount,
bool isEnable,
Guid brandId, Guid brandId,
Guid categoryId) Guid categoryId)
{ {
@ -35,8 +39,10 @@ public partial class Product : ApiEntity
BeDisplayed = beDisplayed; BeDisplayed = beDisplayed;
Cost = cost; Cost = cost;
PackingCost = packingCost; PackingCost = packingCost;
Stock = stock;
HasExpressDelivery = hasExpressDelivery; HasExpressDelivery = hasExpressDelivery;
MaxOrderCount = maxOrderCount; MaxOrderCount = maxOrderCount;
IsEnable = isEnable;
BrandId = brandId; BrandId = brandId;
CategoryId = categoryId; CategoryId = categoryId;
} }
@ -50,13 +56,13 @@ public partial class Product : ApiEntity
public bool IsEnable { get; internal set; } public bool IsEnable { get; internal set; }
public bool BeDisplayed { get; internal set; } public bool BeDisplayed { get; internal set; }
public double PackingCost { get; internal set; } public double PackingCost { get; internal set; }
public int Stock { get; internal set; }
public float Rate { get; internal set; } public float Rate { get; internal set; }
public int ReviewCount { get; internal set; } public int ReviewCount { get; internal set; }
public int Viewed { get; internal set; } public int Viewed { get; internal set; }
public bool HasExpressDelivery { get; internal set; } public bool HasExpressDelivery { get; internal set; }
public int MaxOrderCount { get; internal set; } public int MaxOrderCount { get; internal set; }
public Guid BrandId { get; internal set; } public Guid BrandId { get; internal set; }
public Brand? Brand { get; internal set; } public Brand? Brand { get; internal set; }

View File

@ -2,6 +2,8 @@
public enum Gender public enum Gender
{ {
[Display(Name = "مرد")]
Male, Male,
[Display(Name = "بانو")]
Female Female
} }

View File

@ -17,7 +17,8 @@ namespace NetinaShop.Domain.Mappers
Name = p1.Name, Name = p1.Name,
Description = p1.Description, Description = p1.Description,
Blogs = funcMain1(p1.Blogs), Blogs = funcMain1(p1.Blogs),
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static BlogCategory AdaptTo(this BlogCategoryLDto p3, BlogCategory p4) public static BlogCategory AdaptTo(this BlogCategoryLDto p3, BlogCategory p4)
@ -32,6 +33,7 @@ namespace NetinaShop.Domain.Mappers
result.Description = p3.Description; result.Description = p3.Description;
result.Blogs = funcMain2(p3.Blogs, result.Blogs); result.Blogs = funcMain2(p3.Blogs, result.Blogs);
result.Id = p3.Id; result.Id = p3.Id;
result.CreatedAt = p3.CreatedAt;
return result; return result;
} }
@ -53,9 +55,11 @@ namespace NetinaShop.Domain.Mappers
Name = p8.CategoryName, Name = p8.CategoryName,
Id = p8.CategoryId Id = p8.CategoryId
}, },
Id = p8.Id Id = p8.Id,
CreatedAt = p8.CreatedAt
}).ToList<Blog>(), }).ToList<Blog>(),
Id = p7.Id Id = p7.Id,
CreatedAt = p7.CreatedAt
}; };
public static BlogCategoryLDto AdaptToLDto(this BlogCategory p9) public static BlogCategoryLDto AdaptToLDto(this BlogCategory p9)
{ {
@ -64,7 +68,8 @@ namespace NetinaShop.Domain.Mappers
Name = p9.Name, Name = p9.Name,
Description = p9.Description, Description = p9.Description,
Blogs = funcMain3(p9.Blogs), Blogs = funcMain3(p9.Blogs),
Id = p9.Id Id = p9.Id,
CreatedAt = p9.CreatedAt
}; };
} }
public static BlogCategoryLDto AdaptTo(this BlogCategory p11, BlogCategoryLDto p12) public static BlogCategoryLDto AdaptTo(this BlogCategory p11, BlogCategoryLDto p12)
@ -79,6 +84,7 @@ namespace NetinaShop.Domain.Mappers
result.Description = p11.Description; result.Description = p11.Description;
result.Blogs = funcMain6(p11.Blogs, result.Blogs); result.Blogs = funcMain6(p11.Blogs, result.Blogs);
result.Id = p11.Id; result.Id = p11.Id;
result.CreatedAt = p11.CreatedAt;
return result; return result;
} }
@ -97,9 +103,11 @@ namespace NetinaShop.Domain.Mappers
CategoryId = p16.CategoryId, CategoryId = p16.CategoryId,
CategoryName = p16.Category.Name, CategoryName = p16.Category.Name,
HeaderFileName = p16.Files.Count > 0 && p16.Files.Any<BlogStorageFile>(f => f.IsHeader) ? p16.Files.FirstOrDefault<BlogStorageFile>(f => f.IsHeader).FileName : string.Empty, HeaderFileName = p16.Files.Count > 0 && p16.Files.Any<BlogStorageFile>(f => f.IsHeader) ? p16.Files.FirstOrDefault<BlogStorageFile>(f => f.IsHeader).FileName : string.Empty,
Id = p16.Id Id = p16.Id,
CreatedAt = p16.CreatedAt
}).ToList<BlogSDto>(), }).ToList<BlogSDto>(),
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}; };
public static BlogCategory AdaptToBlogCategory(this BlogCategorySDto p17) public static BlogCategory AdaptToBlogCategory(this BlogCategorySDto p17)
{ {
@ -107,7 +115,8 @@ namespace NetinaShop.Domain.Mappers
{ {
Name = p17.Name, Name = p17.Name,
Description = p17.Description, Description = p17.Description,
Id = p17.Id Id = p17.Id,
CreatedAt = p17.CreatedAt
}; };
} }
public static BlogCategory AdaptTo(this BlogCategorySDto p18, BlogCategory p19) public static BlogCategory AdaptTo(this BlogCategorySDto p18, BlogCategory p19)
@ -121,6 +130,7 @@ namespace NetinaShop.Domain.Mappers
result.Name = p18.Name; result.Name = p18.Name;
result.Description = p18.Description; result.Description = p18.Description;
result.Id = p18.Id; result.Id = p18.Id;
result.CreatedAt = p18.CreatedAt;
return result; return result;
} }
@ -130,7 +140,8 @@ namespace NetinaShop.Domain.Mappers
{ {
Name = p20.Name, Name = p20.Name,
Description = p20.Description, Description = p20.Description,
Id = p20.Id Id = p20.Id,
CreatedAt = p20.CreatedAt
}; };
} }
public static BlogCategorySDto AdaptTo(this BlogCategory p21, BlogCategorySDto p22) public static BlogCategorySDto AdaptTo(this BlogCategory p21, BlogCategorySDto p22)
@ -144,6 +155,7 @@ namespace NetinaShop.Domain.Mappers
result.Name = p21.Name; result.Name = p21.Name;
result.Description = p21.Description; result.Description = p21.Description;
result.Id = p21.Id; result.Id = p21.Id;
result.CreatedAt = p21.CreatedAt;
return result; return result;
} }
@ -151,7 +163,8 @@ namespace NetinaShop.Domain.Mappers
{ {
Name = p23.Name, Name = p23.Name,
Description = p23.Description, Description = p23.Description,
Id = p23.Id Id = p23.Id,
CreatedAt = p23.CreatedAt
}; };
private static List<Blog> funcMain1(List<BlogSDto> p2) private static List<Blog> funcMain1(List<BlogSDto> p2)
@ -182,7 +195,8 @@ namespace NetinaShop.Domain.Mappers
Name = item.CategoryName, Name = item.CategoryName,
Id = item.CategoryId Id = item.CategoryId
}, },
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -218,7 +232,8 @@ namespace NetinaShop.Domain.Mappers
Name = item.CategoryName, Name = item.CategoryName,
Id = item.CategoryId Id = item.CategoryId
}, },
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -251,7 +266,8 @@ namespace NetinaShop.Domain.Mappers
CategoryId = item.CategoryId, CategoryId = item.CategoryId,
CategoryName = item.Category == null ? null : item.Category.Name, CategoryName = item.Category == null ? null : item.Category.Name,
HeaderFileName = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty, HeaderFileName = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -284,7 +300,8 @@ namespace NetinaShop.Domain.Mappers
CategoryId = item.CategoryId, CategoryId = item.CategoryId,
CategoryName = item.Category == null ? null : item.Category.Name, CategoryName = item.Category == null ? null : item.Category.Name,
HeaderFileName = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty, HeaderFileName = item.Files.Count > 0 && item.Files.Any<BlogStorageFile>(funcMain4) ? item.Files.FirstOrDefault<BlogStorageFile>(funcMain5).FileName : string.Empty,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }

View File

@ -23,7 +23,8 @@ namespace NetinaShop.Domain.Mappers
IsSuggested = p1.IsSuggested, IsSuggested = p1.IsSuggested,
CategoryId = p1.CategoryId, CategoryId = p1.CategoryId,
Files = funcMain1(p1.Files), Files = funcMain1(p1.Files),
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Blog AdaptTo(this BlogLDto p3, Blog p4) public static Blog AdaptTo(this BlogLDto p3, Blog p4)
@ -43,6 +44,7 @@ namespace NetinaShop.Domain.Mappers
result.CategoryId = p3.CategoryId; result.CategoryId = p3.CategoryId;
result.Files = funcMain2(p3.Files, result.Files); result.Files = funcMain2(p3.Files, result.Files);
result.Id = p3.Id; result.Id = p3.Id;
result.CreatedAt = p3.CreatedAt;
return result; return result;
} }
@ -66,7 +68,8 @@ namespace NetinaShop.Domain.Mappers
Id = p8.Id, Id = p8.Id,
CreatedAt = p8.CreatedAt CreatedAt = p8.CreatedAt
}).ToList<BlogStorageFile>(), }).ToList<BlogStorageFile>(),
Id = p7.Id Id = p7.Id,
CreatedAt = p7.CreatedAt
}; };
public static BlogLDto AdaptToLDto(this Blog p9) public static BlogLDto AdaptToLDto(this Blog p9)
{ {
@ -81,7 +84,8 @@ namespace NetinaShop.Domain.Mappers
CategoryId = p9.CategoryId, CategoryId = p9.CategoryId,
CategoryName = p9.Category == null ? null : p9.Category.Name, CategoryName = p9.Category == null ? null : p9.Category.Name,
Files = funcMain3(p9.Files), Files = funcMain3(p9.Files),
Id = p9.Id Id = p9.Id,
CreatedAt = p9.CreatedAt
}; };
} }
public static BlogLDto AdaptTo(this Blog p11, BlogLDto p12) public static BlogLDto AdaptTo(this Blog p11, BlogLDto p12)
@ -102,6 +106,7 @@ namespace NetinaShop.Domain.Mappers
result.CategoryName = p11.Category == null ? null : p11.Category.Name; result.CategoryName = p11.Category == null ? null : p11.Category.Name;
result.Files = funcMain4(p11.Files, result.Files); result.Files = funcMain4(p11.Files, result.Files);
result.Id = p11.Id; result.Id = p11.Id;
result.CreatedAt = p11.CreatedAt;
return result; return result;
} }
@ -125,7 +130,8 @@ namespace NetinaShop.Domain.Mappers
FileType = p16.FileType, FileType = p16.FileType,
Id = p16.Id Id = p16.Id
}).ToList<StorageFileSDto>(), }).ToList<StorageFileSDto>(),
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}; };
public static Blog AdaptToBlog(this BlogSDto p17) public static Blog AdaptToBlog(this BlogSDto p17)
{ {
@ -143,7 +149,8 @@ namespace NetinaShop.Domain.Mappers
Name = p17.CategoryName, Name = p17.CategoryName,
Id = p17.CategoryId Id = p17.CategoryId
}, },
Id = p17.Id Id = p17.Id,
CreatedAt = p17.CreatedAt
}; };
} }
public static Blog AdaptTo(this BlogSDto p18, Blog p19) public static Blog AdaptTo(this BlogSDto p18, Blog p19)
@ -163,6 +170,7 @@ namespace NetinaShop.Domain.Mappers
result.CategoryId = p18.CategoryId; result.CategoryId = p18.CategoryId;
result.Category = funcMain5(new Never(), result.Category, p18); result.Category = funcMain5(new Never(), result.Category, p18);
result.Id = p18.Id; result.Id = p18.Id;
result.CreatedAt = p18.CreatedAt;
return result; return result;
} }
@ -179,7 +187,8 @@ namespace NetinaShop.Domain.Mappers
CategoryId = p22.CategoryId, CategoryId = p22.CategoryId,
CategoryName = p22.Category == null ? null : p22.Category.Name, CategoryName = p22.Category == null ? null : p22.Category.Name,
HeaderFileName = p22.Files.Count > 0 && p22.Files.Any<BlogStorageFile>(funcMain6) ? p22.Files.FirstOrDefault<BlogStorageFile>(funcMain7).FileName : string.Empty, HeaderFileName = p22.Files.Count > 0 && p22.Files.Any<BlogStorageFile>(funcMain6) ? p22.Files.FirstOrDefault<BlogStorageFile>(funcMain7).FileName : string.Empty,
Id = p22.Id Id = p22.Id,
CreatedAt = p22.CreatedAt
}; };
} }
public static BlogSDto AdaptTo(this Blog p23, BlogSDto p24) public static BlogSDto AdaptTo(this Blog p23, BlogSDto p24)
@ -200,6 +209,7 @@ namespace NetinaShop.Domain.Mappers
result.CategoryName = p23.Category == null ? null : p23.Category.Name; result.CategoryName = p23.Category == null ? null : p23.Category.Name;
result.HeaderFileName = p23.Files.Count > 0 && p23.Files.Any<BlogStorageFile>(funcMain6) ? p23.Files.FirstOrDefault<BlogStorageFile>(funcMain7).FileName : string.Empty; result.HeaderFileName = p23.Files.Count > 0 && p23.Files.Any<BlogStorageFile>(funcMain6) ? p23.Files.FirstOrDefault<BlogStorageFile>(funcMain7).FileName : string.Empty;
result.Id = p23.Id; result.Id = p23.Id;
result.CreatedAt = p23.CreatedAt;
return result; return result;
} }
@ -214,7 +224,8 @@ namespace NetinaShop.Domain.Mappers
CategoryId = p25.CategoryId, CategoryId = p25.CategoryId,
CategoryName = p25.Category.Name, CategoryName = p25.Category.Name,
HeaderFileName = p25.Files.Count > 0 && p25.Files.Any<BlogStorageFile>(f => f.IsHeader) ? p25.Files.FirstOrDefault<BlogStorageFile>(f => f.IsHeader).FileName : string.Empty, HeaderFileName = p25.Files.Count > 0 && p25.Files.Any<BlogStorageFile>(f => f.IsHeader) ? p25.Files.FirstOrDefault<BlogStorageFile>(f => f.IsHeader).FileName : string.Empty,
Id = p25.Id Id = p25.Id,
CreatedAt = p25.CreatedAt
}; };
private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2) private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2)

View File

@ -19,7 +19,8 @@ namespace NetinaShop.Domain.Mappers
HasSpecialPage = p1.HasSpecialPage, HasSpecialPage = p1.HasSpecialPage,
PageUrl = p1.PageUrl, PageUrl = p1.PageUrl,
Files = funcMain1(p1.Files), Files = funcMain1(p1.Files),
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Brand AdaptTo(this BrandLDto p3, Brand p4) public static Brand AdaptTo(this BrandLDto p3, Brand p4)
@ -36,6 +37,7 @@ namespace NetinaShop.Domain.Mappers
result.PageUrl = p3.PageUrl; result.PageUrl = p3.PageUrl;
result.Files = funcMain2(p3.Files, result.Files); result.Files = funcMain2(p3.Files, result.Files);
result.Id = p3.Id; result.Id = p3.Id;
result.CreatedAt = p3.CreatedAt;
return result; return result;
} }
@ -56,7 +58,8 @@ namespace NetinaShop.Domain.Mappers
Id = p8.Id, Id = p8.Id,
CreatedAt = p8.CreatedAt CreatedAt = p8.CreatedAt
}).ToList<BrandStorageFile>(), }).ToList<BrandStorageFile>(),
Id = p7.Id Id = p7.Id,
CreatedAt = p7.CreatedAt
}; };
public static BrandLDto AdaptToLDto(this Brand p9) public static BrandLDto AdaptToLDto(this Brand p9)
{ {
@ -67,7 +70,8 @@ namespace NetinaShop.Domain.Mappers
HasSpecialPage = p9.HasSpecialPage, HasSpecialPage = p9.HasSpecialPage,
PageUrl = p9.PageUrl, PageUrl = p9.PageUrl,
Files = funcMain3(p9.Files), Files = funcMain3(p9.Files),
Id = p9.Id Id = p9.Id,
CreatedAt = p9.CreatedAt
}; };
} }
public static BrandLDto AdaptTo(this Brand p11, BrandLDto p12) public static BrandLDto AdaptTo(this Brand p11, BrandLDto p12)
@ -84,6 +88,7 @@ namespace NetinaShop.Domain.Mappers
result.PageUrl = p11.PageUrl; result.PageUrl = p11.PageUrl;
result.Files = funcMain4(p11.Files, result.Files); result.Files = funcMain4(p11.Files, result.Files);
result.Id = p11.Id; result.Id = p11.Id;
result.CreatedAt = p11.CreatedAt;
return result; return result;
} }
@ -103,7 +108,8 @@ namespace NetinaShop.Domain.Mappers
FileType = p16.FileType, FileType = p16.FileType,
Id = p16.Id Id = p16.Id
}).ToList<StorageFileSDto>(), }).ToList<StorageFileSDto>(),
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}; };
public static Brand AdaptToBrand(this BrandSDto p17) public static Brand AdaptToBrand(this BrandSDto p17)
{ {
@ -113,7 +119,8 @@ namespace NetinaShop.Domain.Mappers
Description = p17.Description, Description = p17.Description,
HasSpecialPage = p17.HasSpecialPage, HasSpecialPage = p17.HasSpecialPage,
PageUrl = p17.PageUrl, PageUrl = p17.PageUrl,
Id = p17.Id Id = p17.Id,
CreatedAt = p17.CreatedAt
}; };
} }
public static Brand AdaptTo(this BrandSDto p18, Brand p19) public static Brand AdaptTo(this BrandSDto p18, Brand p19)
@ -129,6 +136,7 @@ namespace NetinaShop.Domain.Mappers
result.HasSpecialPage = p18.HasSpecialPage; result.HasSpecialPage = p18.HasSpecialPage;
result.PageUrl = p18.PageUrl; result.PageUrl = p18.PageUrl;
result.Id = p18.Id; result.Id = p18.Id;
result.CreatedAt = p18.CreatedAt;
return result; return result;
} }
@ -141,7 +149,8 @@ namespace NetinaShop.Domain.Mappers
HasSpecialPage = p20.HasSpecialPage, HasSpecialPage = p20.HasSpecialPage,
PageUrl = p20.PageUrl, PageUrl = p20.PageUrl,
HeaderFileName = p20.Files.Count > 0 && p20.Files.Any<BrandStorageFile>(funcMain5) ? p20.Files.FirstOrDefault<BrandStorageFile>(funcMain6).FileName : string.Empty, HeaderFileName = p20.Files.Count > 0 && p20.Files.Any<BrandStorageFile>(funcMain5) ? p20.Files.FirstOrDefault<BrandStorageFile>(funcMain6).FileName : string.Empty,
Id = p20.Id Id = p20.Id,
CreatedAt = p20.CreatedAt
}; };
} }
public static BrandSDto AdaptTo(this Brand p21, BrandSDto p22) public static BrandSDto AdaptTo(this Brand p21, BrandSDto p22)
@ -158,6 +167,7 @@ namespace NetinaShop.Domain.Mappers
result.PageUrl = p21.PageUrl; result.PageUrl = p21.PageUrl;
result.HeaderFileName = p21.Files.Count > 0 && p21.Files.Any<BrandStorageFile>(funcMain5) ? p21.Files.FirstOrDefault<BrandStorageFile>(funcMain6).FileName : string.Empty; result.HeaderFileName = p21.Files.Count > 0 && p21.Files.Any<BrandStorageFile>(funcMain5) ? p21.Files.FirstOrDefault<BrandStorageFile>(funcMain6).FileName : string.Empty;
result.Id = p21.Id; result.Id = p21.Id;
result.CreatedAt = p21.CreatedAt;
return result; return result;
} }
@ -168,7 +178,8 @@ namespace NetinaShop.Domain.Mappers
HasSpecialPage = p23.HasSpecialPage, HasSpecialPage = p23.HasSpecialPage,
PageUrl = p23.PageUrl, PageUrl = p23.PageUrl,
HeaderFileName = p23.Files.Count > 0 && p23.Files.Any<BrandStorageFile>(f => f.IsHeader) ? p23.Files.FirstOrDefault<BrandStorageFile>(f => f.IsHeader).FileName : string.Empty, HeaderFileName = p23.Files.Count > 0 && p23.Files.Any<BrandStorageFile>(f => f.IsHeader) ? p23.Files.FirstOrDefault<BrandStorageFile>(f => f.IsHeader).FileName : string.Empty,
Id = p23.Id Id = p23.Id,
CreatedAt = p23.CreatedAt
}; };
private static List<BrandStorageFile> funcMain1(List<StorageFileSDto> p2) private static List<BrandStorageFile> funcMain1(List<StorageFileSDto> p2)

View File

@ -29,7 +29,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p1.UseCount, UseCount = p1.UseCount,
IsSpecialOffer = p1.IsSpecialOffer, IsSpecialOffer = p1.IsSpecialOffer,
IsForInvitation = p1.IsForInvitation, IsForInvitation = p1.IsForInvitation,
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Discount AdaptTo(this DiscountLDto p2, Discount p3) public static Discount AdaptTo(this DiscountLDto p2, Discount p3)
@ -58,6 +59,7 @@ namespace NetinaShop.Domain.Mappers
result.IsSpecialOffer = p2.IsSpecialOffer; result.IsSpecialOffer = p2.IsSpecialOffer;
result.IsForInvitation = p2.IsForInvitation; result.IsForInvitation = p2.IsForInvitation;
result.Id = p2.Id; result.Id = p2.Id;
result.CreatedAt = p2.CreatedAt;
return result; return result;
} }
@ -80,7 +82,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p4.UseCount, UseCount = p4.UseCount,
IsSpecialOffer = p4.IsSpecialOffer, IsSpecialOffer = p4.IsSpecialOffer,
IsForInvitation = p4.IsForInvitation, IsForInvitation = p4.IsForInvitation,
Id = p4.Id Id = p4.Id,
CreatedAt = p4.CreatedAt
}; };
public static DiscountLDto AdaptToLDto(this Discount p5) public static DiscountLDto AdaptToLDto(this Discount p5)
{ {
@ -103,7 +106,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p5.UseCount, UseCount = p5.UseCount,
IsSpecialOffer = p5.IsSpecialOffer, IsSpecialOffer = p5.IsSpecialOffer,
IsForInvitation = p5.IsForInvitation, IsForInvitation = p5.IsForInvitation,
Id = p5.Id Id = p5.Id,
CreatedAt = p5.CreatedAt
}; };
} }
public static DiscountLDto AdaptTo(this Discount p6, DiscountLDto p7) public static DiscountLDto AdaptTo(this Discount p6, DiscountLDto p7)
@ -132,6 +136,7 @@ namespace NetinaShop.Domain.Mappers
result.IsSpecialOffer = p6.IsSpecialOffer; result.IsSpecialOffer = p6.IsSpecialOffer;
result.IsForInvitation = p6.IsForInvitation; result.IsForInvitation = p6.IsForInvitation;
result.Id = p6.Id; result.Id = p6.Id;
result.CreatedAt = p6.CreatedAt;
return result; return result;
} }
@ -154,7 +159,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p8.UseCount, UseCount = p8.UseCount,
IsSpecialOffer = p8.IsSpecialOffer, IsSpecialOffer = p8.IsSpecialOffer,
IsForInvitation = p8.IsForInvitation, IsForInvitation = p8.IsForInvitation,
Id = p8.Id Id = p8.Id,
CreatedAt = p8.CreatedAt
}; };
public static Discount AdaptToDiscount(this DiscountSDto p9) public static Discount AdaptToDiscount(this DiscountSDto p9)
{ {
@ -177,7 +183,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p9.UseCount, UseCount = p9.UseCount,
IsSpecialOffer = p9.IsSpecialOffer, IsSpecialOffer = p9.IsSpecialOffer,
IsForInvitation = p9.IsForInvitation, IsForInvitation = p9.IsForInvitation,
Id = p9.Id Id = p9.Id,
CreatedAt = p9.CreatedAt
}; };
} }
public static Discount AdaptTo(this DiscountSDto p10, Discount p11) public static Discount AdaptTo(this DiscountSDto p10, Discount p11)
@ -206,6 +213,7 @@ namespace NetinaShop.Domain.Mappers
result.IsSpecialOffer = p10.IsSpecialOffer; result.IsSpecialOffer = p10.IsSpecialOffer;
result.IsForInvitation = p10.IsForInvitation; result.IsForInvitation = p10.IsForInvitation;
result.Id = p10.Id; result.Id = p10.Id;
result.CreatedAt = p10.CreatedAt;
return result; return result;
} }
@ -230,7 +238,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p12.UseCount, UseCount = p12.UseCount,
IsSpecialOffer = p12.IsSpecialOffer, IsSpecialOffer = p12.IsSpecialOffer,
IsForInvitation = p12.IsForInvitation, IsForInvitation = p12.IsForInvitation,
Id = p12.Id Id = p12.Id,
CreatedAt = p12.CreatedAt
}; };
} }
public static DiscountSDto AdaptTo(this Discount p13, DiscountSDto p14) public static DiscountSDto AdaptTo(this Discount p13, DiscountSDto p14)
@ -259,6 +268,7 @@ namespace NetinaShop.Domain.Mappers
result.IsSpecialOffer = p13.IsSpecialOffer; result.IsSpecialOffer = p13.IsSpecialOffer;
result.IsForInvitation = p13.IsForInvitation; result.IsForInvitation = p13.IsForInvitation;
result.Id = p13.Id; result.Id = p13.Id;
result.CreatedAt = p13.CreatedAt;
return result; return result;
} }
@ -281,7 +291,8 @@ namespace NetinaShop.Domain.Mappers
UseCount = p15.UseCount, UseCount = p15.UseCount,
IsSpecialOffer = p15.IsSpecialOffer, IsSpecialOffer = p15.IsSpecialOffer,
IsForInvitation = p15.IsForInvitation, IsForInvitation = p15.IsForInvitation,
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}; };
} }
} }

View File

@ -29,7 +29,8 @@ namespace NetinaShop.Domain.Mappers
DiscountCode = p1.DiscountCode, DiscountCode = p1.DiscountCode,
OrderProducts = funcMain1(p1.OrderProducts), OrderProducts = funcMain1(p1.OrderProducts),
OrderDeliveries = funcMain2(p1.OrderDeliveries), OrderDeliveries = funcMain2(p1.OrderDeliveries),
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Order AdaptTo(this OrderLDto p4, Order p5) public static Order AdaptTo(this OrderLDto p4, Order p5)
@ -56,6 +57,7 @@ namespace NetinaShop.Domain.Mappers
result.OrderProducts = funcMain3(p4.OrderProducts, result.OrderProducts); result.OrderProducts = funcMain3(p4.OrderProducts, result.OrderProducts);
result.OrderDeliveries = funcMain4(p4.OrderDeliveries, result.OrderDeliveries); result.OrderDeliveries = funcMain4(p4.OrderDeliveries, result.OrderDeliveries);
result.Id = p4.Id; result.Id = p4.Id;
result.CreatedAt = p4.CreatedAt;
return result; return result;
} }
@ -82,7 +84,8 @@ namespace NetinaShop.Domain.Mappers
OrderProductStatus = p11.OrderProductStatus, OrderProductStatus = p11.OrderProductStatus,
ProductId = p11.ProductId, ProductId = p11.ProductId,
OrderId = p11.OrderId, OrderId = p11.OrderId,
Id = p11.Id Id = p11.Id,
CreatedAt = p11.CreatedAt
}).ToList<OrderProduct>(), }).ToList<OrderProduct>(),
OrderDeliveries = p10.OrderDeliveries.Select<OrderDeliverySDto, OrderDelivery>(p12 => new OrderDelivery() OrderDeliveries = p10.OrderDeliveries.Select<OrderDeliverySDto, OrderDelivery>(p12 => new OrderDelivery()
{ {
@ -92,9 +95,11 @@ namespace NetinaShop.Domain.Mappers
ReceiverFullName = p12.ReceiverFullName, ReceiverFullName = p12.ReceiverFullName,
ShippingId = p12.ShippingId, ShippingId = p12.ShippingId,
OrderId = p12.OrderId, OrderId = p12.OrderId,
Id = p12.Id Id = p12.Id,
CreatedAt = p12.CreatedAt
}).ToList<OrderDelivery>(), }).ToList<OrderDelivery>(),
Id = p10.Id Id = p10.Id,
CreatedAt = p10.CreatedAt
}; };
public static OrderLDto AdaptToLDto(this Order p13) public static OrderLDto AdaptToLDto(this Order p13)
{ {
@ -115,7 +120,8 @@ namespace NetinaShop.Domain.Mappers
DiscountCode = p13.DiscountCode, DiscountCode = p13.DiscountCode,
OrderProducts = funcMain5(p13.OrderProducts), OrderProducts = funcMain5(p13.OrderProducts),
OrderDeliveries = funcMain6(p13.OrderDeliveries), OrderDeliveries = funcMain6(p13.OrderDeliveries),
Id = p13.Id Id = p13.Id,
CreatedAt = p13.CreatedAt
}; };
} }
public static OrderLDto AdaptTo(this Order p16, OrderLDto p17) public static OrderLDto AdaptTo(this Order p16, OrderLDto p17)
@ -142,6 +148,7 @@ namespace NetinaShop.Domain.Mappers
result.OrderProducts = funcMain7(p16.OrderProducts, result.OrderProducts); result.OrderProducts = funcMain7(p16.OrderProducts, result.OrderProducts);
result.OrderDeliveries = funcMain8(p16.OrderDeliveries, result.OrderDeliveries); result.OrderDeliveries = funcMain8(p16.OrderDeliveries, result.OrderDeliveries);
result.Id = p16.Id; result.Id = p16.Id;
result.CreatedAt = p16.CreatedAt;
return result; return result;
} }
@ -168,7 +175,8 @@ namespace NetinaShop.Domain.Mappers
OrderProductStatus = p23.OrderProductStatus, OrderProductStatus = p23.OrderProductStatus,
ProductId = p23.ProductId, ProductId = p23.ProductId,
OrderId = p23.OrderId, OrderId = p23.OrderId,
Id = p23.Id Id = p23.Id,
CreatedAt = p23.CreatedAt
}).ToList<OrderProductSDto>(), }).ToList<OrderProductSDto>(),
OrderDeliveries = p22.OrderDeliveries.Select<OrderDelivery, OrderDeliverySDto>(p24 => new OrderDeliverySDto() OrderDeliveries = p22.OrderDeliveries.Select<OrderDelivery, OrderDeliverySDto>(p24 => new OrderDeliverySDto()
{ {
@ -178,9 +186,11 @@ namespace NetinaShop.Domain.Mappers
ReceiverFullName = p24.ReceiverFullName, ReceiverFullName = p24.ReceiverFullName,
OrderId = p24.OrderId, OrderId = p24.OrderId,
ShippingId = p24.ShippingId, ShippingId = p24.ShippingId,
Id = p24.Id Id = p24.Id,
CreatedAt = p24.CreatedAt
}).ToList<OrderDeliverySDto>(), }).ToList<OrderDeliverySDto>(),
Id = p22.Id Id = p22.Id,
CreatedAt = p22.CreatedAt
}; };
public static Order AdaptToOrder(this OrderSDto p25) public static Order AdaptToOrder(this OrderSDto p25)
{ {
@ -199,7 +209,8 @@ namespace NetinaShop.Domain.Mappers
OrderAt = p25.OrderAt, OrderAt = p25.OrderAt,
PreparingMinute = p25.PreparingMinute, PreparingMinute = p25.PreparingMinute,
DiscountCode = p25.DiscountCode, DiscountCode = p25.DiscountCode,
Id = p25.Id Id = p25.Id,
CreatedAt = p25.CreatedAt
}; };
} }
public static Order AdaptTo(this OrderSDto p26, Order p27) public static Order AdaptTo(this OrderSDto p26, Order p27)
@ -224,6 +235,7 @@ namespace NetinaShop.Domain.Mappers
result.PreparingMinute = p26.PreparingMinute; result.PreparingMinute = p26.PreparingMinute;
result.DiscountCode = p26.DiscountCode; result.DiscountCode = p26.DiscountCode;
result.Id = p26.Id; result.Id = p26.Id;
result.CreatedAt = p26.CreatedAt;
return result; return result;
} }
@ -244,7 +256,8 @@ namespace NetinaShop.Domain.Mappers
OrderAt = p28.OrderAt, OrderAt = p28.OrderAt,
PreparingMinute = p28.PreparingMinute, PreparingMinute = p28.PreparingMinute,
DiscountCode = p28.DiscountCode, DiscountCode = p28.DiscountCode,
Id = p28.Id Id = p28.Id,
CreatedAt = p28.CreatedAt
}; };
} }
public static OrderSDto AdaptTo(this Order p29, OrderSDto p30) public static OrderSDto AdaptTo(this Order p29, OrderSDto p30)
@ -269,6 +282,7 @@ namespace NetinaShop.Domain.Mappers
result.PreparingMinute = p29.PreparingMinute; result.PreparingMinute = p29.PreparingMinute;
result.DiscountCode = p29.DiscountCode; result.DiscountCode = p29.DiscountCode;
result.Id = p29.Id; result.Id = p29.Id;
result.CreatedAt = p29.CreatedAt;
return result; return result;
} }
@ -287,7 +301,8 @@ namespace NetinaShop.Domain.Mappers
OrderAt = p31.OrderAt, OrderAt = p31.OrderAt,
PreparingMinute = p31.PreparingMinute, PreparingMinute = p31.PreparingMinute,
DiscountCode = p31.DiscountCode, DiscountCode = p31.DiscountCode,
Id = p31.Id Id = p31.Id,
CreatedAt = p31.CreatedAt
}; };
private static List<OrderProduct> funcMain1(List<OrderProductSDto> p2) private static List<OrderProduct> funcMain1(List<OrderProductSDto> p2)
@ -312,7 +327,8 @@ namespace NetinaShop.Domain.Mappers
OrderProductStatus = item.OrderProductStatus, OrderProductStatus = item.OrderProductStatus,
ProductId = item.ProductId, ProductId = item.ProductId,
OrderId = item.OrderId, OrderId = item.OrderId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -342,7 +358,8 @@ namespace NetinaShop.Domain.Mappers
ReceiverFullName = item.ReceiverFullName, ReceiverFullName = item.ReceiverFullName,
ShippingId = item.ShippingId, ShippingId = item.ShippingId,
OrderId = item.OrderId, OrderId = item.OrderId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -372,7 +389,8 @@ namespace NetinaShop.Domain.Mappers
OrderProductStatus = item.OrderProductStatus, OrderProductStatus = item.OrderProductStatus,
ProductId = item.ProductId, ProductId = item.ProductId,
OrderId = item.OrderId, OrderId = item.OrderId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -402,7 +420,8 @@ namespace NetinaShop.Domain.Mappers
ReceiverFullName = item.ReceiverFullName, ReceiverFullName = item.ReceiverFullName,
ShippingId = item.ShippingId, ShippingId = item.ShippingId,
OrderId = item.OrderId, OrderId = item.OrderId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -432,7 +451,8 @@ namespace NetinaShop.Domain.Mappers
OrderProductStatus = item.OrderProductStatus, OrderProductStatus = item.OrderProductStatus,
ProductId = item.ProductId, ProductId = item.ProductId,
OrderId = item.OrderId, OrderId = item.OrderId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -462,7 +482,8 @@ namespace NetinaShop.Domain.Mappers
ReceiverFullName = item.ReceiverFullName, ReceiverFullName = item.ReceiverFullName,
OrderId = item.OrderId, OrderId = item.OrderId,
ShippingId = item.ShippingId, ShippingId = item.ShippingId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -492,7 +513,8 @@ namespace NetinaShop.Domain.Mappers
OrderProductStatus = item.OrderProductStatus, OrderProductStatus = item.OrderProductStatus,
ProductId = item.ProductId, ProductId = item.ProductId,
OrderId = item.OrderId, OrderId = item.OrderId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -522,7 +544,8 @@ namespace NetinaShop.Domain.Mappers
ReceiverFullName = item.ReceiverFullName, ReceiverFullName = item.ReceiverFullName,
OrderId = item.OrderId, OrderId = item.OrderId,
ShippingId = item.ShippingId, ShippingId = item.ShippingId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }

View File

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using Mapster.Models;
using NetinaShop.Domain.Dtos.LargDtos; using NetinaShop.Domain.Dtos.LargDtos;
using NetinaShop.Domain.Dtos.SmallDtos; using NetinaShop.Domain.Dtos.SmallDtos;
using NetinaShop.Domain.Entities.ProductCategories; using NetinaShop.Domain.Entities.ProductCategories;
@ -18,7 +19,8 @@ namespace NetinaShop.Domain.Mappers
Description = p1.Description, Description = p1.Description,
ParentId = (Guid?)p1.ParentId, ParentId = (Guid?)p1.ParentId,
Files = funcMain1(p1.Files), Files = funcMain1(p1.Files),
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static ProductCategory AdaptTo(this ProductCategoryLDto p3, ProductCategory p4) public static ProductCategory AdaptTo(this ProductCategoryLDto p3, ProductCategory p4)
@ -34,6 +36,7 @@ namespace NetinaShop.Domain.Mappers
result.ParentId = (Guid?)p3.ParentId; result.ParentId = (Guid?)p3.ParentId;
result.Files = funcMain2(p3.Files, result.Files); result.Files = funcMain2(p3.Files, result.Files);
result.Id = p3.Id; result.Id = p3.Id;
result.CreatedAt = p3.CreatedAt;
return result; return result;
} }
@ -53,7 +56,8 @@ namespace NetinaShop.Domain.Mappers
Id = p8.Id, Id = p8.Id,
CreatedAt = p8.CreatedAt CreatedAt = p8.CreatedAt
}).ToList<ProductCategoryStorageFile>(), }).ToList<ProductCategoryStorageFile>(),
Id = p7.Id Id = p7.Id,
CreatedAt = p7.CreatedAt
}; };
public static ProductCategoryLDto AdaptToLDto(this ProductCategory p9) public static ProductCategoryLDto AdaptToLDto(this ProductCategory p9)
{ {
@ -63,7 +67,8 @@ namespace NetinaShop.Domain.Mappers
Description = p9.Description, Description = p9.Description,
ParentId = p9.ParentId == null ? default(Guid) : (Guid)p9.ParentId, ParentId = p9.ParentId == null ? default(Guid) : (Guid)p9.ParentId,
Files = funcMain3(p9.Files), Files = funcMain3(p9.Files),
Id = p9.Id Id = p9.Id,
CreatedAt = p9.CreatedAt
}; };
} }
public static ProductCategoryLDto AdaptTo(this ProductCategory p11, ProductCategoryLDto p12) public static ProductCategoryLDto AdaptTo(this ProductCategory p11, ProductCategoryLDto p12)
@ -79,6 +84,7 @@ namespace NetinaShop.Domain.Mappers
result.ParentId = p11.ParentId == null ? default(Guid) : (Guid)p11.ParentId; result.ParentId = p11.ParentId == null ? default(Guid) : (Guid)p11.ParentId;
result.Files = funcMain4(p11.Files, result.Files); result.Files = funcMain4(p11.Files, result.Files);
result.Id = p11.Id; result.Id = p11.Id;
result.CreatedAt = p11.CreatedAt;
return result; return result;
} }
@ -97,7 +103,8 @@ namespace NetinaShop.Domain.Mappers
FileType = p16.FileType, FileType = p16.FileType,
Id = p16.Id Id = p16.Id
}).ToList<StorageFileSDto>(), }).ToList<StorageFileSDto>(),
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}; };
public static ProductCategory AdaptToProductCategory(this ProductCategorySDto p17) public static ProductCategory AdaptToProductCategory(this ProductCategorySDto p17)
{ {
@ -107,7 +114,13 @@ namespace NetinaShop.Domain.Mappers
Description = p17.Description, Description = p17.Description,
IsMain = p17.IsMain, IsMain = p17.IsMain,
ParentId = (Guid?)p17.ParentId, ParentId = (Guid?)p17.ParentId,
Id = p17.Id Parent = new ProductCategory()
{
Name = p17.ParentName,
Id = p17.ParentId
},
Id = p17.Id,
CreatedAt = p17.CreatedAt
}; };
} }
public static ProductCategory AdaptTo(this ProductCategorySDto p18, ProductCategory p19) public static ProductCategory AdaptTo(this ProductCategorySDto p18, ProductCategory p19)
@ -122,47 +135,52 @@ namespace NetinaShop.Domain.Mappers
result.Description = p18.Description; result.Description = p18.Description;
result.IsMain = p18.IsMain; result.IsMain = p18.IsMain;
result.ParentId = (Guid?)p18.ParentId; result.ParentId = (Guid?)p18.ParentId;
result.Parent = funcMain5(new Never(), result.Parent, p18);
result.Id = p18.Id; result.Id = p18.Id;
result.CreatedAt = p18.CreatedAt;
return result; return result;
} }
public static ProductCategorySDto AdaptToSDto(this ProductCategory p20) public static ProductCategorySDto AdaptToSDto(this ProductCategory p22)
{ {
return p20 == null ? null : new ProductCategorySDto() return p22 == null ? null : new ProductCategorySDto()
{ {
Name = p20.Name, Name = p22.Name,
Description = p20.Description, Description = p22.Description,
IsMain = p20.IsMain, IsMain = p22.IsMain,
ParentId = p20.ParentId == null ? default(Guid) : (Guid)p20.ParentId, ParentId = p22.ParentId == null ? default(Guid) : (Guid)p22.ParentId,
ParentName = p20.Parent == null ? null : p20.Parent.Name, ParentName = p22.Parent != null ? p22.Parent.Name : string.Empty,
Id = p20.Id Id = p22.Id,
CreatedAt = p22.CreatedAt
}; };
} }
public static ProductCategorySDto AdaptTo(this ProductCategory p21, ProductCategorySDto p22) public static ProductCategorySDto AdaptTo(this ProductCategory p23, ProductCategorySDto p24)
{ {
if (p21 == null) if (p23 == null)
{ {
return null; return null;
} }
ProductCategorySDto result = p22 ?? new ProductCategorySDto(); ProductCategorySDto result = p24 ?? new ProductCategorySDto();
result.Name = p21.Name; result.Name = p23.Name;
result.Description = p21.Description; result.Description = p23.Description;
result.IsMain = p21.IsMain; result.IsMain = p23.IsMain;
result.ParentId = p21.ParentId == null ? default(Guid) : (Guid)p21.ParentId; result.ParentId = p23.ParentId == null ? default(Guid) : (Guid)p23.ParentId;
result.ParentName = p21.Parent == null ? null : p21.Parent.Name; result.ParentName = p23.Parent != null ? p23.Parent.Name : string.Empty;
result.Id = p21.Id; result.Id = p23.Id;
result.CreatedAt = p23.CreatedAt;
return result; return result;
} }
public static Expression<Func<ProductCategory, ProductCategorySDto>> ProjectToSDto => p23 => new ProductCategorySDto() public static Expression<Func<ProductCategory, ProductCategorySDto>> ProjectToSDto => p25 => new ProductCategorySDto()
{ {
Name = p23.Name, Name = p25.Name,
Description = p23.Description, Description = p25.Description,
IsMain = p23.IsMain, IsMain = p25.IsMain,
ParentId = p23.ParentId == null ? default(Guid) : (Guid)p23.ParentId, ParentId = p25.ParentId == null ? default(Guid) : (Guid)p25.ParentId,
ParentName = p23.Parent.Name, ParentName = p25.Parent != null ? p25.Parent.Name : string.Empty,
Id = p23.Id Id = p25.Id,
CreatedAt = p25.CreatedAt
}; };
private static List<ProductCategoryStorageFile> funcMain1(List<StorageFileSDto> p2) private static List<ProductCategoryStorageFile> funcMain1(List<StorageFileSDto> p2)
@ -286,5 +304,15 @@ namespace NetinaShop.Domain.Mappers
return result; return result;
} }
private static ProductCategory funcMain5(Never p20, ProductCategory p21, ProductCategorySDto p18)
{
ProductCategory result = p21 ?? new ProductCategory();
result.Name = p18.ParentName;
result.Id = p18.ParentId;
return result;
}
} }
} }

View File

@ -2,8 +2,11 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using Mapster.Models;
using NetinaShop.Domain.Dtos.LargDtos; using NetinaShop.Domain.Dtos.LargDtos;
using NetinaShop.Domain.Dtos.SmallDtos; using NetinaShop.Domain.Dtos.SmallDtos;
using NetinaShop.Domain.Entities.Brands;
using NetinaShop.Domain.Entities.ProductCategories;
using NetinaShop.Domain.Entities.Products; using NetinaShop.Domain.Entities.Products;
namespace NetinaShop.Domain.Mappers namespace NetinaShop.Domain.Mappers
@ -23,6 +26,7 @@ namespace NetinaShop.Domain.Mappers
Cost = p1.Cost, Cost = p1.Cost,
BeDisplayed = p1.BeDisplayed, BeDisplayed = p1.BeDisplayed,
PackingCost = p1.PackingCost, PackingCost = p1.PackingCost,
Stock = p1.Stock,
HasExpressDelivery = p1.HasExpressDelivery, HasExpressDelivery = p1.HasExpressDelivery,
MaxOrderCount = p1.MaxOrderCount, MaxOrderCount = p1.MaxOrderCount,
BrandId = p1.BrandId, BrandId = p1.BrandId,
@ -30,7 +34,8 @@ namespace NetinaShop.Domain.Mappers
Specifications = funcMain1(p1.Specifications), Specifications = funcMain1(p1.Specifications),
Reviews = funcMain2(p1.Reviews), Reviews = funcMain2(p1.Reviews),
Files = funcMain3(p1.Files), Files = funcMain3(p1.Files),
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Product AdaptTo(this ProductLDto p5, Product p6) public static Product AdaptTo(this ProductLDto p5, Product p6)
@ -50,6 +55,7 @@ namespace NetinaShop.Domain.Mappers
result.Cost = p5.Cost; result.Cost = p5.Cost;
result.BeDisplayed = p5.BeDisplayed; result.BeDisplayed = p5.BeDisplayed;
result.PackingCost = p5.PackingCost; result.PackingCost = p5.PackingCost;
result.Stock = p5.Stock;
result.HasExpressDelivery = p5.HasExpressDelivery; result.HasExpressDelivery = p5.HasExpressDelivery;
result.MaxOrderCount = p5.MaxOrderCount; result.MaxOrderCount = p5.MaxOrderCount;
result.BrandId = p5.BrandId; result.BrandId = p5.BrandId;
@ -58,6 +64,7 @@ namespace NetinaShop.Domain.Mappers
result.Reviews = funcMain5(p5.Reviews, result.Reviews); result.Reviews = funcMain5(p5.Reviews, result.Reviews);
result.Files = funcMain6(p5.Files, result.Files); result.Files = funcMain6(p5.Files, result.Files);
result.Id = p5.Id; result.Id = p5.Id;
result.CreatedAt = p5.CreatedAt;
return result; return result;
} }
@ -72,6 +79,7 @@ namespace NetinaShop.Domain.Mappers
Cost = p13.Cost, Cost = p13.Cost,
BeDisplayed = p13.BeDisplayed, BeDisplayed = p13.BeDisplayed,
PackingCost = p13.PackingCost, PackingCost = p13.PackingCost,
Stock = p13.Stock,
HasExpressDelivery = p13.HasExpressDelivery, HasExpressDelivery = p13.HasExpressDelivery,
MaxOrderCount = p13.MaxOrderCount, MaxOrderCount = p13.MaxOrderCount,
BrandId = p13.BrandId, BrandId = p13.BrandId,
@ -84,7 +92,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = p14.IsFeature, IsFeature = p14.IsFeature,
ProductId = p14.ProductId, ProductId = p14.ProductId,
ParentId = (Guid?)p14.ParentId, ParentId = (Guid?)p14.ParentId,
Id = p14.Id Id = p14.Id,
CreatedAt = p14.CreatedAt
}).ToList<Specification>(), }).ToList<Specification>(),
Reviews = p13.Reviews.Select<ReviewSDto, Review>(p15 => new Review() Reviews = p13.Reviews.Select<ReviewSDto, Review>(p15 => new Review()
{ {
@ -94,7 +103,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = p15.IsBuyer, IsBuyer = p15.IsBuyer,
ProductId = p15.ProductId, ProductId = p15.ProductId,
UserId = p15.UserId, UserId = p15.UserId,
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}).ToList<Review>(), }).ToList<Review>(),
Files = p13.Files.Select<StorageFileSDto, ProductStorageFile>(p16 => new ProductStorageFile() Files = p13.Files.Select<StorageFileSDto, ProductStorageFile>(p16 => new ProductStorageFile()
{ {
@ -107,7 +117,8 @@ namespace NetinaShop.Domain.Mappers
Id = p16.Id, Id = p16.Id,
CreatedAt = p16.CreatedAt CreatedAt = p16.CreatedAt
}).ToList<ProductStorageFile>(), }).ToList<ProductStorageFile>(),
Id = p13.Id Id = p13.Id,
CreatedAt = p13.CreatedAt
}; };
public static ProductLDto AdaptToLDto(this Product p17) public static ProductLDto AdaptToLDto(this Product p17)
{ {
@ -124,6 +135,7 @@ namespace NetinaShop.Domain.Mappers
MaxOrderCount = p17.MaxOrderCount, MaxOrderCount = p17.MaxOrderCount,
Cost = p17.Cost, Cost = p17.Cost,
PackingCost = p17.PackingCost, PackingCost = p17.PackingCost,
Stock = p17.Stock,
BrandId = p17.BrandId, BrandId = p17.BrandId,
BrandName = p17.Brand == null ? null : p17.Brand.Name, BrandName = p17.Brand == null ? null : p17.Brand.Name,
CategoryId = p17.CategoryId, CategoryId = p17.CategoryId,
@ -131,7 +143,8 @@ namespace NetinaShop.Domain.Mappers
Specifications = funcMain7(p17.Specifications), Specifications = funcMain7(p17.Specifications),
Reviews = funcMain8(p17.Reviews), Reviews = funcMain8(p17.Reviews),
Files = funcMain9(p17.Files), Files = funcMain9(p17.Files),
Id = p17.Id Id = p17.Id,
CreatedAt = p17.CreatedAt
}; };
} }
public static ProductLDto AdaptTo(this Product p21, ProductLDto p22) public static ProductLDto AdaptTo(this Product p21, ProductLDto p22)
@ -153,6 +166,7 @@ namespace NetinaShop.Domain.Mappers
result.MaxOrderCount = p21.MaxOrderCount; result.MaxOrderCount = p21.MaxOrderCount;
result.Cost = p21.Cost; result.Cost = p21.Cost;
result.PackingCost = p21.PackingCost; result.PackingCost = p21.PackingCost;
result.Stock = p21.Stock;
result.BrandId = p21.BrandId; result.BrandId = p21.BrandId;
result.BrandName = p21.Brand == null ? null : p21.Brand.Name; result.BrandName = p21.Brand == null ? null : p21.Brand.Name;
result.CategoryId = p21.CategoryId; result.CategoryId = p21.CategoryId;
@ -161,6 +175,7 @@ namespace NetinaShop.Domain.Mappers
result.Reviews = funcMain11(p21.Reviews, result.Reviews); result.Reviews = funcMain11(p21.Reviews, result.Reviews);
result.Files = funcMain12(p21.Files, result.Files); result.Files = funcMain12(p21.Files, result.Files);
result.Id = p21.Id; result.Id = p21.Id;
result.CreatedAt = p21.CreatedAt;
return result; return result;
} }
@ -177,6 +192,7 @@ namespace NetinaShop.Domain.Mappers
MaxOrderCount = p29.MaxOrderCount, MaxOrderCount = p29.MaxOrderCount,
Cost = p29.Cost, Cost = p29.Cost,
PackingCost = p29.PackingCost, PackingCost = p29.PackingCost,
Stock = p29.Stock,
BrandId = p29.BrandId, BrandId = p29.BrandId,
BrandName = p29.Brand.Name, BrandName = p29.Brand.Name,
CategoryId = p29.CategoryId, CategoryId = p29.CategoryId,
@ -189,7 +205,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = p30.IsFeature, IsFeature = p30.IsFeature,
ProductId = p30.ProductId, ProductId = p30.ProductId,
ParentId = p30.ParentId == null ? default(Guid) : (Guid)p30.ParentId, ParentId = p30.ParentId == null ? default(Guid) : (Guid)p30.ParentId,
Id = p30.Id Id = p30.Id,
CreatedAt = p30.CreatedAt
}).ToList<SpecificationSDto>(), }).ToList<SpecificationSDto>(),
Reviews = p29.Reviews.Select<Review, ReviewSDto>(p31 => new ReviewSDto() Reviews = p29.Reviews.Select<Review, ReviewSDto>(p31 => new ReviewSDto()
{ {
@ -199,7 +216,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = p31.IsBuyer, IsBuyer = p31.IsBuyer,
ProductId = p31.ProductId, ProductId = p31.ProductId,
UserId = p31.UserId, UserId = p31.UserId,
Id = p31.Id Id = p31.Id,
CreatedAt = p31.CreatedAt
}).ToList<ReviewSDto>(), }).ToList<ReviewSDto>(),
Files = p29.Files.Select<ProductStorageFile, StorageFileSDto>(p32 => new StorageFileSDto() Files = p29.Files.Select<ProductStorageFile, StorageFileSDto>(p32 => new StorageFileSDto()
{ {
@ -211,7 +229,8 @@ namespace NetinaShop.Domain.Mappers
FileType = p32.FileType, FileType = p32.FileType,
Id = p32.Id Id = p32.Id
}).ToList<StorageFileSDto>(), }).ToList<StorageFileSDto>(),
Id = p29.Id Id = p29.Id,
CreatedAt = p29.CreatedAt
}; };
public static Product AdaptToProduct(this ProductSDto p33) public static Product AdaptToProduct(this ProductSDto p33)
{ {
@ -231,8 +250,19 @@ namespace NetinaShop.Domain.Mappers
ReviewCount = p33.ReviewCount, ReviewCount = p33.ReviewCount,
Viewed = p33.Viewed, Viewed = p33.Viewed,
BrandId = p33.BrandId, BrandId = p33.BrandId,
Brand = new Brand()
{
Name = p33.BrandName,
Id = p33.BrandId
},
CategoryId = p33.CategoryId, CategoryId = p33.CategoryId,
Id = p33.Id Category = new ProductCategory()
{
Name = p33.CategoryName,
Id = p33.CategoryId
},
Id = p33.Id,
CreatedAt = p33.CreatedAt
}; };
} }
public static Product AdaptTo(this ProductSDto p34, Product p35) public static Product AdaptTo(this ProductSDto p34, Product p35)
@ -257,81 +287,90 @@ namespace NetinaShop.Domain.Mappers
result.ReviewCount = p34.ReviewCount; result.ReviewCount = p34.ReviewCount;
result.Viewed = p34.Viewed; result.Viewed = p34.Viewed;
result.BrandId = p34.BrandId; result.BrandId = p34.BrandId;
result.Brand = funcMain13(new Never(), result.Brand, p34);
result.CategoryId = p34.CategoryId; result.CategoryId = p34.CategoryId;
result.Category = funcMain14(new Never(), result.Category, p34);
result.Id = p34.Id; result.Id = p34.Id;
result.CreatedAt = p34.CreatedAt;
return result; return result;
} }
public static ProductSDto AdaptToSDto(this Product p36) public static ProductSDto AdaptToSDto(this Product p40)
{ {
return p36 == null ? null : new ProductSDto() return p40 == null ? null : new ProductSDto()
{ {
PersianName = p36.PersianName, PersianName = p40.PersianName,
EnglishName = p36.EnglishName, EnglishName = p40.EnglishName,
Summery = p36.Summery, Summery = p40.Summery,
ExpertCheck = p36.ExpertCheck, ExpertCheck = p40.ExpertCheck,
Tags = p36.Tags, Tags = p40.Tags,
Warranty = p36.Warranty, Warranty = p40.Warranty,
Cost = p36.Cost, Cost = p40.Cost,
IsEnable = p36.IsEnable, IsEnable = p40.IsEnable,
BeDisplayed = p36.BeDisplayed, BeDisplayed = p40.BeDisplayed,
PackingCost = p36.PackingCost, PackingCost = p40.PackingCost,
Rate = p36.Rate, Rate = p40.Rate,
ReviewCount = p36.ReviewCount, ReviewCount = p40.ReviewCount,
Viewed = p36.Viewed, Viewed = p40.Viewed,
CategoryId = p36.CategoryId, CategoryId = p40.CategoryId,
BrandId = p36.BrandId, BrandId = p40.BrandId,
CategoryName = p36.Category == null ? null : p36.Category.Name, BrandName = p40.Brand == null ? null : p40.Brand.Name,
Id = p36.Id CategoryName = p40.Category == null ? null : p40.Category.Name,
Id = p40.Id,
CreatedAt = p40.CreatedAt
}; };
} }
public static ProductSDto AdaptTo(this Product p37, ProductSDto p38) public static ProductSDto AdaptTo(this Product p41, ProductSDto p42)
{ {
if (p37 == null) if (p41 == null)
{ {
return null; return null;
} }
ProductSDto result = p38 ?? new ProductSDto(); ProductSDto result = p42 ?? new ProductSDto();
result.PersianName = p37.PersianName; result.PersianName = p41.PersianName;
result.EnglishName = p37.EnglishName; result.EnglishName = p41.EnglishName;
result.Summery = p37.Summery; result.Summery = p41.Summery;
result.ExpertCheck = p37.ExpertCheck; result.ExpertCheck = p41.ExpertCheck;
result.Tags = p37.Tags; result.Tags = p41.Tags;
result.Warranty = p37.Warranty; result.Warranty = p41.Warranty;
result.Cost = p37.Cost; result.Cost = p41.Cost;
result.IsEnable = p37.IsEnable; result.IsEnable = p41.IsEnable;
result.BeDisplayed = p37.BeDisplayed; result.BeDisplayed = p41.BeDisplayed;
result.PackingCost = p37.PackingCost; result.PackingCost = p41.PackingCost;
result.Rate = p37.Rate; result.Rate = p41.Rate;
result.ReviewCount = p37.ReviewCount; result.ReviewCount = p41.ReviewCount;
result.Viewed = p37.Viewed; result.Viewed = p41.Viewed;
result.CategoryId = p37.CategoryId; result.CategoryId = p41.CategoryId;
result.BrandId = p37.BrandId; result.BrandId = p41.BrandId;
result.CategoryName = p37.Category == null ? null : p37.Category.Name; result.BrandName = p41.Brand == null ? null : p41.Brand.Name;
result.Id = p37.Id; result.CategoryName = p41.Category == null ? null : p41.Category.Name;
result.Id = p41.Id;
result.CreatedAt = p41.CreatedAt;
return result; return result;
} }
public static Expression<Func<Product, ProductSDto>> ProjectToSDto => p39 => new ProductSDto() public static Expression<Func<Product, ProductSDto>> ProjectToSDto => p43 => new ProductSDto()
{ {
PersianName = p39.PersianName, PersianName = p43.PersianName,
EnglishName = p39.EnglishName, EnglishName = p43.EnglishName,
Summery = p39.Summery, Summery = p43.Summery,
ExpertCheck = p39.ExpertCheck, ExpertCheck = p43.ExpertCheck,
Tags = p39.Tags, Tags = p43.Tags,
Warranty = p39.Warranty, Warranty = p43.Warranty,
Cost = p39.Cost, Cost = p43.Cost,
IsEnable = p39.IsEnable, IsEnable = p43.IsEnable,
BeDisplayed = p39.BeDisplayed, BeDisplayed = p43.BeDisplayed,
PackingCost = p39.PackingCost, PackingCost = p43.PackingCost,
Rate = p39.Rate, Rate = p43.Rate,
ReviewCount = p39.ReviewCount, ReviewCount = p43.ReviewCount,
Viewed = p39.Viewed, Viewed = p43.Viewed,
CategoryId = p39.CategoryId, CategoryId = p43.CategoryId,
BrandId = p39.BrandId, BrandId = p43.BrandId,
CategoryName = p39.Category.Name, BrandName = p43.Brand == null ? null : p43.Brand.Name,
Id = p39.Id CategoryName = p43.Category == null ? null : p43.Category.Name,
Id = p43.Id,
CreatedAt = p43.CreatedAt
}; };
private static List<Specification> funcMain1(List<SpecificationSDto> p2) private static List<Specification> funcMain1(List<SpecificationSDto> p2)
@ -356,7 +395,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = item.IsFeature, IsFeature = item.IsFeature,
ProductId = item.ProductId, ProductId = item.ProductId,
ParentId = (Guid?)item.ParentId, ParentId = (Guid?)item.ParentId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -386,7 +426,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = item.IsBuyer, IsBuyer = item.IsBuyer,
ProductId = item.ProductId, ProductId = item.ProductId,
UserId = item.UserId, UserId = item.UserId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -447,7 +488,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = item.IsFeature, IsFeature = item.IsFeature,
ProductId = item.ProductId, ProductId = item.ProductId,
ParentId = (Guid?)item.ParentId, ParentId = (Guid?)item.ParentId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -477,7 +519,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = item.IsBuyer, IsBuyer = item.IsBuyer,
ProductId = item.ProductId, ProductId = item.ProductId,
UserId = item.UserId, UserId = item.UserId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -538,7 +581,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = item.IsFeature, IsFeature = item.IsFeature,
ProductId = item.ProductId, ProductId = item.ProductId,
ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -568,7 +612,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = item.IsBuyer, IsBuyer = item.IsBuyer,
ProductId = item.ProductId, ProductId = item.ProductId,
UserId = item.UserId, UserId = item.UserId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -628,7 +673,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = item.IsFeature, IsFeature = item.IsFeature,
ProductId = item.ProductId, ProductId = item.ProductId,
ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -658,7 +704,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = item.IsBuyer, IsBuyer = item.IsBuyer,
ProductId = item.ProductId, ProductId = item.ProductId,
UserId = item.UserId, UserId = item.UserId,
Id = item.Id Id = item.Id,
CreatedAt = item.CreatedAt
}); });
i++; i++;
} }
@ -695,5 +742,25 @@ namespace NetinaShop.Domain.Mappers
return result; return result;
} }
private static Brand funcMain13(Never p36, Brand p37, ProductSDto p34)
{
Brand result = p37 ?? new Brand();
result.Name = p34.BrandName;
result.Id = p34.BrandId;
return result;
}
private static ProductCategory funcMain14(Never p38, ProductCategory p39, ProductSDto p34)
{
ProductCategory result = p39 ?? new ProductCategory();
result.Name = p34.CategoryName;
result.Id = p34.CategoryId;
return result;
}
} }
} }

View File

@ -19,7 +19,8 @@ namespace NetinaShop.Domain.Mappers
IsConfirmed = p1.IsConfirmed, IsConfirmed = p1.IsConfirmed,
ProductId = p1.ProductId, ProductId = p1.ProductId,
UserId = p1.UserId, UserId = p1.UserId,
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Review AdaptTo(this ReviewLDto p2, Review p3) public static Review AdaptTo(this ReviewLDto p2, Review p3)
@ -38,6 +39,7 @@ namespace NetinaShop.Domain.Mappers
result.ProductId = p2.ProductId; result.ProductId = p2.ProductId;
result.UserId = p2.UserId; result.UserId = p2.UserId;
result.Id = p2.Id; result.Id = p2.Id;
result.CreatedAt = p2.CreatedAt;
return result; return result;
} }
@ -50,7 +52,8 @@ namespace NetinaShop.Domain.Mappers
IsConfirmed = p4.IsConfirmed, IsConfirmed = p4.IsConfirmed,
ProductId = p4.ProductId, ProductId = p4.ProductId,
UserId = p4.UserId, UserId = p4.UserId,
Id = p4.Id Id = p4.Id,
CreatedAt = p4.CreatedAt
}; };
public static ReviewLDto AdaptToLDto(this Review p5) public static ReviewLDto AdaptToLDto(this Review p5)
{ {
@ -63,7 +66,8 @@ namespace NetinaShop.Domain.Mappers
IsConfirmed = p5.IsConfirmed, IsConfirmed = p5.IsConfirmed,
ProductId = p5.ProductId, ProductId = p5.ProductId,
UserId = p5.UserId, UserId = p5.UserId,
Id = p5.Id Id = p5.Id,
CreatedAt = p5.CreatedAt
}; };
} }
public static ReviewLDto AdaptTo(this Review p6, ReviewLDto p7) public static ReviewLDto AdaptTo(this Review p6, ReviewLDto p7)
@ -82,6 +86,7 @@ namespace NetinaShop.Domain.Mappers
result.ProductId = p6.ProductId; result.ProductId = p6.ProductId;
result.UserId = p6.UserId; result.UserId = p6.UserId;
result.Id = p6.Id; result.Id = p6.Id;
result.CreatedAt = p6.CreatedAt;
return result; return result;
} }
@ -94,7 +99,8 @@ namespace NetinaShop.Domain.Mappers
IsConfirmed = p8.IsConfirmed, IsConfirmed = p8.IsConfirmed,
ProductId = p8.ProductId, ProductId = p8.ProductId,
UserId = p8.UserId, UserId = p8.UserId,
Id = p8.Id Id = p8.Id,
CreatedAt = p8.CreatedAt
}; };
public static Review AdaptToReview(this ReviewSDto p9) public static Review AdaptToReview(this ReviewSDto p9)
{ {
@ -106,7 +112,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = p9.IsBuyer, IsBuyer = p9.IsBuyer,
ProductId = p9.ProductId, ProductId = p9.ProductId,
UserId = p9.UserId, UserId = p9.UserId,
Id = p9.Id Id = p9.Id,
CreatedAt = p9.CreatedAt
}; };
} }
public static Review AdaptTo(this ReviewSDto p10, Review p11) public static Review AdaptTo(this ReviewSDto p10, Review p11)
@ -124,6 +131,7 @@ namespace NetinaShop.Domain.Mappers
result.ProductId = p10.ProductId; result.ProductId = p10.ProductId;
result.UserId = p10.UserId; result.UserId = p10.UserId;
result.Id = p10.Id; result.Id = p10.Id;
result.CreatedAt = p10.CreatedAt;
return result; return result;
} }
@ -137,7 +145,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = p12.IsBuyer, IsBuyer = p12.IsBuyer,
ProductId = p12.ProductId, ProductId = p12.ProductId,
UserId = p12.UserId, UserId = p12.UserId,
Id = p12.Id Id = p12.Id,
CreatedAt = p12.CreatedAt
}; };
} }
public static ReviewSDto AdaptTo(this Review p13, ReviewSDto p14) public static ReviewSDto AdaptTo(this Review p13, ReviewSDto p14)
@ -155,6 +164,7 @@ namespace NetinaShop.Domain.Mappers
result.ProductId = p13.ProductId; result.ProductId = p13.ProductId;
result.UserId = p13.UserId; result.UserId = p13.UserId;
result.Id = p13.Id; result.Id = p13.Id;
result.CreatedAt = p13.CreatedAt;
return result; return result;
} }
@ -166,7 +176,8 @@ namespace NetinaShop.Domain.Mappers
IsBuyer = p15.IsBuyer, IsBuyer = p15.IsBuyer,
ProductId = p15.ProductId, ProductId = p15.ProductId,
UserId = p15.UserId, UserId = p15.UserId,
Id = p15.Id Id = p15.Id,
CreatedAt = p15.CreatedAt
}; };
} }
} }

View File

@ -9,7 +9,11 @@ namespace NetinaShop.Domain.Mappers
{ {
public static Shipping AdaptToShipping(this ShippingSDto p1) public static Shipping AdaptToShipping(this ShippingSDto p1)
{ {
return p1 == null ? null : new Shipping() {Id = p1.Id}; return p1 == null ? null : new Shipping()
{
Id = p1.Id,
CreatedAt = p1.CreatedAt
};
} }
public static Shipping AdaptTo(this ShippingSDto p2, Shipping p3) public static Shipping AdaptTo(this ShippingSDto p2, Shipping p3)
{ {
@ -20,12 +24,17 @@ namespace NetinaShop.Domain.Mappers
Shipping result = p3 ?? new Shipping(); Shipping result = p3 ?? new Shipping();
result.Id = p2.Id; result.Id = p2.Id;
result.CreatedAt = p2.CreatedAt;
return result; return result;
} }
public static ShippingSDto AdaptToSDto(this Shipping p4) public static ShippingSDto AdaptToSDto(this Shipping p4)
{ {
return p4 == null ? null : new ShippingSDto() {Id = p4.Id}; return p4 == null ? null : new ShippingSDto()
{
Id = p4.Id,
CreatedAt = p4.CreatedAt
};
} }
public static ShippingSDto AdaptTo(this Shipping p5, ShippingSDto p6) public static ShippingSDto AdaptTo(this Shipping p5, ShippingSDto p6)
{ {
@ -36,9 +45,14 @@ namespace NetinaShop.Domain.Mappers
ShippingSDto result = p6 ?? new ShippingSDto(); ShippingSDto result = p6 ?? new ShippingSDto();
result.Id = p5.Id; result.Id = p5.Id;
result.CreatedAt = p5.CreatedAt;
return result; return result;
} }
public static Expression<Func<Shipping, ShippingSDto>> ProjectToSDto => p7 => new ShippingSDto() {Id = p7.Id}; public static Expression<Func<Shipping, ShippingSDto>> ProjectToSDto => p7 => new ShippingSDto()
{
Id = p7.Id,
CreatedAt = p7.CreatedAt
};
} }
} }

View File

@ -17,7 +17,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = p1.IsFeature, IsFeature = p1.IsFeature,
ProductId = p1.ProductId, ProductId = p1.ProductId,
ParentId = (Guid?)p1.ParentId, ParentId = (Guid?)p1.ParentId,
Id = p1.Id Id = p1.Id,
CreatedAt = p1.CreatedAt
}; };
} }
public static Specification AdaptTo(this SpecificationSDto p2, Specification p3) public static Specification AdaptTo(this SpecificationSDto p2, Specification p3)
@ -35,6 +36,7 @@ namespace NetinaShop.Domain.Mappers
result.ProductId = p2.ProductId; result.ProductId = p2.ProductId;
result.ParentId = (Guid?)p2.ParentId; result.ParentId = (Guid?)p2.ParentId;
result.Id = p2.Id; result.Id = p2.Id;
result.CreatedAt = p2.CreatedAt;
return result; return result;
} }
@ -48,7 +50,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = p4.IsFeature, IsFeature = p4.IsFeature,
ProductId = p4.ProductId, ProductId = p4.ProductId,
ParentId = p4.ParentId == null ? default(Guid) : (Guid)p4.ParentId, ParentId = p4.ParentId == null ? default(Guid) : (Guid)p4.ParentId,
Id = p4.Id Id = p4.Id,
CreatedAt = p4.CreatedAt
}; };
} }
public static SpecificationSDto AdaptTo(this Specification p5, SpecificationSDto p6) public static SpecificationSDto AdaptTo(this Specification p5, SpecificationSDto p6)
@ -66,6 +69,7 @@ namespace NetinaShop.Domain.Mappers
result.ProductId = p5.ProductId; result.ProductId = p5.ProductId;
result.ParentId = p5.ParentId == null ? default(Guid) : (Guid)p5.ParentId; result.ParentId = p5.ParentId == null ? default(Guid) : (Guid)p5.ParentId;
result.Id = p5.Id; result.Id = p5.Id;
result.CreatedAt = p5.CreatedAt;
return result; return result;
} }
@ -77,7 +81,8 @@ namespace NetinaShop.Domain.Mappers
IsFeature = p7.IsFeature, IsFeature = p7.IsFeature,
ProductId = p7.ProductId, ProductId = p7.ProductId,
ParentId = p7.ParentId == null ? default(Guid) : (Guid)p7.ParentId, ParentId = p7.ParentId == null ? default(Guid) : (Guid)p7.ParentId,
Id = p7.Id Id = p7.Id,
CreatedAt = p7.CreatedAt
}; };
} }
} }

View File

@ -12,8 +12,15 @@ public class MapsterRegister : IRegister
.Map("HeaderFileName", o => o.Files.Count > 0 && o.Files.Any(f => f.IsHeader) ? o.Files.FirstOrDefault(f => f.IsHeader)!.FileName : string.Empty) .Map("HeaderFileName", o => o.Files.Count > 0 && o.Files.Any(f => f.IsHeader) ? o.Files.FirstOrDefault(f => f.IsHeader)!.FileName : string.Empty)
.TwoWays(); .TwoWays();
config.NewConfig<ProductCategory, ProductSDto>() config.NewConfig<ProductCategory, ProductCategorySDto>()
.Map("ParentName", o => o.Parent != null ? o.Parent.Name : string.Empty) .Map("ParentName", o => o.Parent != null ? o.Parent.Name : string.Empty)
.TwoWays(); .TwoWays();
config.NewConfig<Product, ProductSDto>()
.Map("CategoryName", o => o.Category == null ? null : o.Category.Name)
.Map("BrandName", o => o.Brand == null ? null : o.Brand.Name)
.IgnoreNullValues(false)
.TwoWays();
} }
} }

View File

@ -7,146 +7,173 @@ public static class ApplicationClaims
public static ClaimDto ManageBlogs { get; } = new ClaimDto public static ClaimDto ManageBlogs { get; } = new ClaimDto
{ {
Title = "مدیریت بلاگ ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageBlogs, Value = ApplicationPermission.ManageBlogs,
}; };
public static ClaimDto ViewBlogs { get; } = new ClaimDto public static ClaimDto ViewBlogs { get; } = new ClaimDto
{ {
Title = "مشاهده بلاگ ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewBlogs, Value = ApplicationPermission.ViewBlogs,
}; };
public static ClaimDto ManageBrands { get; } = new ClaimDto public static ClaimDto ManageBrands { get; } = new ClaimDto
{ {
Title = "مدیریت برند ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageBrands, Value = ApplicationPermission.ManageBrands,
}; };
public static ClaimDto ViewBrands { get; } = new ClaimDto public static ClaimDto ViewBrands { get; } = new ClaimDto
{ {
Title = "مشاهده برند ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewBrands, Value = ApplicationPermission.ViewBrands,
}; };
public static ClaimDto ManageCategories { get; } = new ClaimDto public static ClaimDto ManageCategories { get; } = new ClaimDto
{ {
Title = "مدیریت دسته بندی ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageCategories, Value = ApplicationPermission.ManageCategories,
}; };
public static ClaimDto ViewCategories { get; } = new ClaimDto public static ClaimDto ViewCategories { get; } = new ClaimDto
{ {
Title = "مشاهده دسته بندی ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewCategories, Value = ApplicationPermission.ViewCategories,
}; };
public static ClaimDto ManageDiscounts { get; } = new ClaimDto public static ClaimDto ManageDiscounts { get; } = new ClaimDto
{ {
Title = "مدیریت تخفیف ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageDiscounts, Value = ApplicationPermission.ManageDiscounts,
}; };
public static ClaimDto ViewDiscounts { get; } = new ClaimDto public static ClaimDto ViewDiscounts { get; } = new ClaimDto
{ {
Title = "مشاهده تخفیف ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewDiscounts, Value = ApplicationPermission.ViewDiscounts,
}; };
public static ClaimDto ManageOrders { get; } = new ClaimDto public static ClaimDto ManageOrders { get; } = new ClaimDto
{ {
Title = "مدیریت فروش ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageOrders, Value = ApplicationPermission.ManageOrders,
}; };
public static ClaimDto ViewAllOrders { get; } = new ClaimDto public static ClaimDto ViewAllOrders { get; } = new ClaimDto
{ {
Title = "مشاهده فروش ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewAllOrders, Value = ApplicationPermission.ViewAllOrders,
}; };
public static ClaimDto ViewMineOrders { get; } = new ClaimDto public static ClaimDto ViewMineOrders { get; } = new ClaimDto
{ {
Title = "مشاهده فروش های خود",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewMineOrders, Value = ApplicationPermission.ViewMineOrders,
}; };
public static ClaimDto CreateOrder { get; } = new ClaimDto public static ClaimDto CreateOrder { get; } = new ClaimDto
{ {
Title = "ثبت سفارش",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.CreateOrder, Value = ApplicationPermission.CreateOrder,
}; };
public static ClaimDto ManageProducts { get; } = new ClaimDto public static ClaimDto ManageProducts { get; } = new ClaimDto
{ {
Title = "مدیریت محصولات",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageProducts, Value = ApplicationPermission.ManageProducts,
}; };
public static ClaimDto ViewProducts { get; } = new ClaimDto public static ClaimDto ViewProducts { get; } = new ClaimDto
{ {
Title = "مشاهده محصولات",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewProducts, Value = ApplicationPermission.ViewProducts,
}; };
public static ClaimDto ManageReview { get; } = new ClaimDto public static ClaimDto ManageReview { get; } = new ClaimDto
{ {
Title = "مدیریت کامنت ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageReview, Value = ApplicationPermission.ManageReview,
}; };
public static ClaimDto ViewAllReviews { get; } = new ClaimDto public static ClaimDto ViewAllReviews { get; } = new ClaimDto
{ {
Title = "مشاهده کامنت ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewAllReviews, Value = ApplicationPermission.ViewAllReviews,
}; };
public static ClaimDto ViewMineReviews { get; } = new ClaimDto public static ClaimDto ViewMineReviews { get; } = new ClaimDto
{ {
Title = "مشاهده کامنت های خود",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewMineReviews, Value = ApplicationPermission.ViewMineReviews,
}; };
public static ClaimDto AddReview { get; } = new ClaimDto public static ClaimDto AddReview { get; } = new ClaimDto
{ {
Title = "ثبت کامنت جدید",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.AddReview, Value = ApplicationPermission.AddReview,
}; };
public static ClaimDto ConfirmReview { get; } = new ClaimDto public static ClaimDto ConfirmReview { get; } = new ClaimDto
{ {
Title = "تائید کامنت ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ConfirmReview, Value = ApplicationPermission.ConfirmReview,
}; };
public static ClaimDto ViewWarehouses { get; } = new ClaimDto public static ClaimDto ViewWarehouses { get; } = new ClaimDto
{ {
Title = "مشاهده انبار ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewWarehouses, Value = ApplicationPermission.ViewWarehouses,
}; };
public static ClaimDto ManageWarehouses { get; } = new ClaimDto public static ClaimDto ManageWarehouses { get; } = new ClaimDto
{ {
Title = "مدیریت انبار ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageWarehouses, Value = ApplicationPermission.ManageWarehouses,
}; };
public static ClaimDto ViewShipping { get; } = new ClaimDto public static ClaimDto ViewShipping { get; } = new ClaimDto
{ {
Title = "مشاهده روش های ارسال",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewShipping, Value = ApplicationPermission.ViewShipping,
}; };
public static ClaimDto ManageShipping { get; } = new ClaimDto public static ClaimDto ManageShipping { get; } = new ClaimDto
{ {
Title = "مدیریت روش های ارسال",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageShipping, Value = ApplicationPermission.ManageShipping,
}; };
public static ClaimDto ManageUsers { get; } = new ClaimDto public static ClaimDto ManageUsers { get; } = new ClaimDto
{ {
Title = "مدیریت کاربران",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageUsers, Value = ApplicationPermission.ManageUsers,
}; };
public static ClaimDto ViewUsers { get; } = new ClaimDto public static ClaimDto ViewUsers { get; } = new ClaimDto
{ {
Title = "مشاهده کاربران",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewUsers, Value = ApplicationPermission.ViewUsers,
}; };
public static ClaimDto ManageFiles { get; } = new ClaimDto public static ClaimDto ManageFiles { get; } = new ClaimDto
{ {
Title = "مدیریت فایل ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ManageFiles, Value = ApplicationPermission.ManageFiles,
}; };
public static ClaimDto ViewFiles { get; } = new ClaimDto public static ClaimDto ViewFiles { get; } = new ClaimDto
{ {
Title = "مشاهده فایل ها",
Type = CustomClaimType.Permission, Type = CustomClaimType.Permission,
Value = ApplicationPermission.ViewFiles, Value = ApplicationPermission.ViewFiles,
}; };

View File

@ -12,7 +12,7 @@
<PackageReference Include="Mapster" Version="7.4.0" /> <PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Mapster.Core" Version="1.2.1" /> <PackageReference Include="Mapster.Core" Version="1.2.1" />
<PackageReference Include="MediatR" Version="12.2.0" /> <PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="8.0.1" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" /> <PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
</ItemGroup>--> </ItemGroup>-->

View File

@ -8,7 +8,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AWSSDK.S3" Version="3.7.305.17" /> <PackageReference Include="AWSSDK.S3" Version="3.7.305.22" />
<PackageReference Include="Refit" Version="7.0.0" /> <PackageReference Include="Refit" Version="7.0.0" />
</ItemGroup> </ItemGroup>

View File

@ -5,5 +5,7 @@ public interface ICurrentUserService : IScopedDependency
string? UserId { get; } string? UserId { get; }
string? RoleName { get; } string? RoleName { get; }
string? UserName { get; } string? UserName { get; }
string? DeviceId { get; }
bool IsAuthorized { get; }
public List<string>? Permissions { get; } public List<string>? Permissions { get; }
} }

View File

@ -79,7 +79,10 @@ public static class ModelBuilderExtensions
.SelectMany(t => t.GetForeignKeys()) .SelectMany(t => t.GetForeignKeys())
.Where(fk => !fk.IsOwnership && fk.DeleteBehavior == DeleteBehavior.Cascade); .Where(fk => !fk.IsOwnership && fk.DeleteBehavior == DeleteBehavior.Cascade);
foreach (var fk in cascadeFKs) foreach (var fk in cascadeFKs)
{
fk.DeleteBehavior = DeleteBehavior.Restrict; fk.DeleteBehavior = DeleteBehavior.Restrict;
fk.IsRequired = false;
}
} }
/// <summary> /// <summary>
@ -97,13 +100,13 @@ public static class ModelBuilderExtensions
.Where(c => c.IsClass && !c.IsAbstract && c.IsPublic); .Where(c => c.IsClass && !c.IsAbstract && c.IsPublic);
foreach (var type in types) foreach (var type in types)
foreach (var iface in type.GetInterfaces()) foreach (var iface in type.GetInterfaces())
if (iface.IsConstructedGenericType && if (iface.IsConstructedGenericType &&
iface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>)) iface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>))
{ {
var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(iface.GenericTypeArguments[0]); var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(iface.GenericTypeArguments[0]);
applyConcreteMethod.Invoke(modelBuilder, new[] { Activator.CreateInstance(type) }); applyConcreteMethod.Invoke(modelBuilder, new[] { Activator.CreateInstance(type) });
} }
} }
@ -137,11 +140,8 @@ public static class ModelBuilderExtensions
var builderQueryFilter = new ModelBuilderQueryFilter(); var builderQueryFilter = new ModelBuilderQueryFilter();
foreach (var type in types) foreach (var type in types)
{ {
var stopwatch = new Stopwatch();
stopwatch.Start();
modelBuilder.Entity(type); modelBuilder.Entity(type);
builderQueryFilter.AddQueryFilterToModelBuilder(modelBuilder, type); builderQueryFilter.AddQueryFilterToModelBuilder(modelBuilder, type);
stopwatch.Stop();
} }
} }

View File

@ -18,7 +18,7 @@ public class GetBrandsQueryHandler : IRequestHandler<GetBrandsQuery, List<BrandS
List<BrandSDto> brands = new List<BrandSDto>(); List<BrandSDto> brands = new List<BrandSDto>();
if (request.CategoryId != default) if (request.CategoryId != default)
{ {
var products = await _mediator.Send(new GetProductsQuery(BrandIds: null, Page:0, SortBy: QuerySortBy.None,CategoryId: request.CategoryId, IsActive : null), var products = await _mediator.Send(new GetProductsQuery(BrandIds: null,SpecialOffer: null, Page:0, SortBy: QuerySortBy.None,CategoryId: request.CategoryId, IsActive : null),
cancellationToken); cancellationToken);
var brandGrouped = products.GroupBy(p => p.BrandId); var brandGrouped = products.GroupBy(p => p.BrandId);
foreach (var grouping in brandGrouped) foreach (var grouping in brandGrouped)

View File

@ -38,7 +38,7 @@ public class UpdateDiscountCommandHandler : IRequestHandler<UpdateDiscountComman
break; break;
case DiscountType.Product: case DiscountType.Product:
var productEnt = await _repositoryWrapper.SetRepository<CategoryDiscount>().TableNoTracking.FirstOrDefaultAsync(d => d.Id == request.Id, cancellationToken); var productEnt = await _repositoryWrapper.SetRepository<ProductDiscount>().TableNoTracking.FirstOrDefaultAsync(d => d.Id == request.Id, cancellationToken);
if (productEnt == null) if (productEnt == null)
throw new AppException("Discount not found", ApiResultStatusCode.NotFound); throw new AppException("Discount not found", ApiResultStatusCode.NotFound);

View File

@ -14,7 +14,10 @@ public class CreateProductCommandHandler : IRequestHandler<CreateProductCommand,
public async Task<ProductLDto> Handle(CreateProductCommand request, CancellationToken cancellationToken) public async Task<ProductLDto> Handle(CreateProductCommand request, CancellationToken cancellationToken)
{ {
var ent = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck, var ent = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck,
request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost,request.HasExpressDelivery,request.MaxOrderCount, request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost,
request.HasExpressDelivery,
request.Stock,
request.MaxOrderCount,
request.BrandId,request.CategoryId); request.BrandId,request.CategoryId);
foreach (var specification in request.Specifications) foreach (var specification in request.Specifications)

View File

@ -1,11 +1,14 @@
namespace NetinaShop.Repository.Handlers.Products; using Microsoft.EntityFrameworkCore.Internal;
using NetinaShop.Domain.Dtos.SmallDtos;
namespace NetinaShop.Repository.Handlers.Products;
public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<ProductSDto>> public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<ProductSDto>>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
private readonly IMediator _mediator; private readonly IMediator _mediator;
public GetProductsQueryHandler(IRepositoryWrapper repositoryWrapper,IMediator mediator) public GetProductsQueryHandler(IRepositoryWrapper repositoryWrapper, IMediator mediator)
{ {
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
_mediator = mediator; _mediator = mediator;
@ -14,7 +17,7 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
{ {
var products = _repositoryWrapper.SetRepository<Product>().TableNoTracking; var products = _repositoryWrapper.SetRepository<Product>().TableNoTracking;
if (request.IsActive != null) if (request.IsActive != null)
products = products.Where(p => p.IsEnable == request.IsActive ); products = products.Where(p => p.IsEnable == request.IsActive);
if (request.ProductName != null) if (request.ProductName != null)
products = products.Where(p => p.PersianName.ToLower().Trim().Contains(request.ProductName.ToLower().Trim())); products = products.Where(p => p.PersianName.ToLower().Trim().Contains(request.ProductName.ToLower().Trim()));
if (request.CategoryId != default) if (request.CategoryId != default)
@ -44,7 +47,22 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
products = products.OrderByDescending(p => p.CreatedAt); products = products.OrderByDescending(p => p.CreatedAt);
} }
var productSDtos = await products.Skip(request.Page * 20) if (request.SpecialOffer != null)
{
if (request.SpecialOffer.Value)
{
var productDiscount = await _repositoryWrapper.SetRepository<ProductDiscount>()
.TableNoTracking
.Where(d => d.HasCode == false && d.IsSpecialOffer && d.ExpireDate.Date >= DateTime.Today.Date)
.OrderByDescending(d => d.CreatedAt)
.Select(d => d.ProductId)
.ToListAsync(cancellationToken);
products = products.Where(p => productDiscount.Contains(p.Id));
}
}
List<ProductSDto> productSDtos = await products
.Skip(request.Page * 20)
.Take(20) .Take(20)
.Select(ProductMapper.ProjectToSDto) .Select(ProductMapper.ProjectToSDto)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
@ -55,7 +73,7 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
productSDto.CostWithDiscount = productSDto.Cost; productSDto.CostWithDiscount = productSDto.Cost;
var categoryDiscount = await _repositoryWrapper.SetRepository<CategoryDiscount>() var categoryDiscount = await _repositoryWrapper.SetRepository<CategoryDiscount>()
.TableNoTracking .TableNoTracking
.FirstOrDefaultAsync(d => d.CategoryId == productSDto.CategoryId && d.HasCode == false && d.ExpireDate.Date > DateTime.Today.Date, cancellationToken); .FirstOrDefaultAsync(d => d.CategoryId == productSDto.CategoryId && d.HasCode == false && d.ExpireDate.Date >= DateTime.Today.Date, cancellationToken);
if (categoryDiscount != null && !categoryDiscount.IsExpired()) if (categoryDiscount != null && !categoryDiscount.IsExpired())
{ {
@ -69,7 +87,7 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
var productDiscount = await _repositoryWrapper.SetRepository<ProductDiscount>() var productDiscount = await _repositoryWrapper.SetRepository<ProductDiscount>()
.TableNoTracking .TableNoTracking
.Where(d => d.HasCode == false && d.ProductId == productSDto.Id && d.ExpireDate.Date > DateTime.Today.Date) .Where(d => d.HasCode == false && d.ProductId == productSDto.Id && d.ExpireDate.Date >= DateTime.Today.Date)
.OrderByDescending(d => d.CreatedAt) .OrderByDescending(d => d.CreatedAt)
.FirstOrDefaultAsync(cancellationToken); .FirstOrDefaultAsync(cancellationToken);

View File

@ -24,6 +24,7 @@ public class UpdateProductCommandHandler : IRequestHandler<UpdateProductCommand,
request.Cost, request.Cost,
request.PackingCost, request.PackingCost,
request.HasExpressDelivery, request.HasExpressDelivery,
request.Stock,
request.MaxOrderCount, request.MaxOrderCount,
request.BrandId, request.BrandId,
request.CategoryId); request.CategoryId);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,918 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class EditForeigenKeies : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "UserFavoriteProducts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "UserFavoriteProducts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "UserFavoriteProducts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "UserAddresses",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "UserAddresses",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "UserAddresses",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "StorageFiles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "StorageFiles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "StorageFiles",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Specifications",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Specifications",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Specifications",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Shippings",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Shippings",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Shippings",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Reviews",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Reviews",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Reviews",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Products",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Products",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Products",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "ProductCategories",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "ProductCategories",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "ProductCategories",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Orders",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Orders",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Orders",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "OrderProducts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "OrderProducts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "OrderProducts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "OrderDeliveries",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "OrderDeliveries",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "OrderDeliveries",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Discounts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Discounts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Discounts",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Brands",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Brands",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Brands",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Blogs",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Blogs",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Blogs",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "BlogCategories",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "BlogCategories",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "BlogCategories",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "UserFavoriteProducts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "UserFavoriteProducts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "UserFavoriteProducts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "UserAddresses",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "UserAddresses",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "UserAddresses",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "StorageFiles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "StorageFiles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "StorageFiles",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Specifications",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Specifications",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Specifications",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Shippings",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Shippings",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Shippings",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Reviews",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Reviews",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Reviews",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Products",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Products",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Products",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "ProductCategories",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "ProductCategories",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "ProductCategories",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Orders",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Orders",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Orders",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "OrderProducts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "OrderProducts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "OrderProducts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "OrderDeliveries",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "OrderDeliveries",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "OrderDeliveries",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Discounts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Discounts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Discounts",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Brands",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Brands",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Brands",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "Blogs",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "Blogs",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "Blogs",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "RemovedBy",
schema: "public",
table: "BlogCategories",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "ModifiedBy",
schema: "public",
table: "BlogCategories",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "CreatedBy",
schema: "public",
table: "BlogCategories",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class EditOrderAddDeviceId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "DeviceId",
schema: "public",
table: "Orders",
type: "text",
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DeviceId",
schema: "public",
table: "Orders");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,68 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class EditOrderNullUserId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders");
migrationBuilder.AlterColumn<Guid>(
name: "UserId",
schema: "public",
table: "Orders",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders",
column: "UserId",
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders");
migrationBuilder.AlterColumn<Guid>(
name: "UserId",
schema: "public",
table: "Orders",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders",
column: "UserId",
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,81 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class EditOrderUserId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders");
migrationBuilder.DropColumn(
name: "DeviceId",
schema: "public",
table: "Orders");
migrationBuilder.AlterColumn<Guid>(
name: "UserId",
schema: "public",
table: "Orders",
type: "uuid",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
oldClrType: typeof(Guid),
oldType: "uuid",
oldNullable: true);
migrationBuilder.AddForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders",
column: "UserId",
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders");
migrationBuilder.AlterColumn<Guid>(
name: "UserId",
schema: "public",
table: "Orders",
type: "uuid",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uuid");
migrationBuilder.AddColumn<string>(
name: "DeviceId",
schema: "public",
table: "Orders",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddForeignKey(
name: "FK_Orders_Users_UserId",
schema: "public",
table: "Orders",
column: "UserId",
principalSchema: "public",
principalTable: "Users",
principalColumn: "Id");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace NetinaShop.Repository.Migrations
{
/// <inheritdoc />
public partial class EditProductIsEnable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "Stock",
schema: "public",
table: "Products",
type: "integer",
nullable: false,
defaultValue: 0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Stock",
schema: "public",
table: "Products");
}
}
}

View File

@ -18,7 +18,7 @@ namespace NetinaShop.Repository.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasDefaultSchema("public") .HasDefaultSchema("public")
.HasAnnotation("ProductVersion", "8.0.0") .HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -143,6 +143,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
@ -155,6 +156,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("ReadingTime") b.Property<int>("ReadingTime")
@ -164,6 +166,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Summery") b.Property<string>("Summery")
@ -195,6 +198,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Description") b.Property<string>("Description")
@ -208,6 +212,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
@ -218,6 +223,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -235,6 +241,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Description") b.Property<string>("Description")
@ -251,6 +258,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
@ -265,6 +273,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -292,6 +301,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<long>("DiscountAmount") b.Property<long>("DiscountAmount")
@ -333,6 +343,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<long>("PriceCeiling") b.Property<long>("PriceCeiling")
@ -345,6 +356,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<DateTime>("StartDate") b.Property<DateTime>("StartDate")
@ -375,6 +387,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<double>("DeliveryPrice") b.Property<double>("DeliveryPrice")
@ -403,6 +416,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<DateTime>("OrderAt") b.Property<DateTime>("OrderAt")
@ -427,6 +441,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<double>("ServicePrice") b.Property<double>("ServicePrice")
@ -467,6 +482,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<double>("DeliveryCost") b.Property<double>("DeliveryCost")
@ -479,6 +495,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("OrderId") b.Property<Guid>("OrderId")
@ -500,6 +517,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("ShippingId") b.Property<Guid>("ShippingId")
@ -527,6 +545,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
@ -536,6 +555,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("OrderId") b.Property<Guid>("OrderId")
@ -566,6 +586,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -587,6 +608,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Description") b.Property<string>("Description")
@ -603,6 +625,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
@ -616,6 +639,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -647,6 +671,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("EnglishName") b.Property<string>("EnglishName")
@ -673,6 +698,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<double>("PackingCost") b.Property<double>("PackingCost")
@ -689,11 +715,15 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("ReviewCount") b.Property<int>("ReviewCount")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Stock")
.HasColumnType("integer");
b.Property<string>("Summery") b.Property<string>("Summery")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
@ -732,6 +762,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<bool>("IsBuyer") b.Property<bool>("IsBuyer")
@ -747,6 +778,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("ProductId") b.Property<Guid>("ProductId")
@ -759,6 +791,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Title") b.Property<string>("Title")
@ -787,6 +820,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Detail") b.Property<string>("Detail")
@ -803,6 +837,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid?>("ParentId") b.Property<Guid?>("ParentId")
@ -815,6 +850,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Title") b.Property<string>("Title")
@ -844,6 +880,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Discriminator") b.Property<string>("Discriminator")
@ -875,6 +912,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
@ -885,6 +923,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@ -1035,6 +1074,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
@ -1050,6 +1090,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("PostalCode") b.Property<string>("PostalCode")
@ -1068,6 +1109,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("UserId") b.Property<Guid>("UserId")
@ -1090,6 +1132,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<bool>("IsRemoved") b.Property<bool>("IsRemoved")
@ -1099,6 +1142,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("ProductId") b.Property<Guid>("ProductId")
@ -1108,6 +1152,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<Guid>("UserId") b.Property<Guid>("UserId")
@ -1132,6 +1177,7 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("CreatedBy") b.Property<string>("CreatedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<double>("DeliveryCost") b.Property<double>("DeliveryCost")
@ -1153,12 +1199,14 @@ namespace NetinaShop.Repository.Migrations
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("ModifiedBy") b.Property<string>("ModifiedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<DateTime>("RemovedAt") b.Property<DateTime>("RemovedAt")
.HasColumnType("timestamp without time zone"); .HasColumnType("timestamp without time zone");
b.Property<string>("RemovedBy") b.Property<string>("RemovedBy")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Title") b.Property<string>("Title")
@ -1251,8 +1299,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null)
.WithMany() .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<System.Guid>", b =>
@ -1260,8 +1307,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null)
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<System.Guid>", b =>
@ -1269,8 +1315,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null)
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<System.Guid>", b =>
@ -1278,14 +1323,12 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null)
.WithMany() .WithMany()
.HasForeignKey("RoleId") .HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null)
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
}); });
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b => modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<System.Guid>", b =>
@ -1293,8 +1336,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null)
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
}); });
modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b =>
@ -1302,8 +1344,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category") b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category")
.WithMany("Blogs") .WithMany("Blogs")
.HasForeignKey("CategoryId") .HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Category"); b.Navigation("Category");
}); });
@ -1317,8 +1358,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("User"); b.Navigation("User");
}); });
@ -1328,14 +1368,12 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order")
.WithMany("OrderDeliveries") .WithMany("OrderDeliveries")
.HasForeignKey("OrderId") .HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping")
.WithMany() .WithMany()
.HasForeignKey("ShippingId") .HasForeignKey("ShippingId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Order"); b.Navigation("Order");
@ -1347,14 +1385,12 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order")
.WithMany("OrderProducts") .WithMany("OrderProducts")
.HasForeignKey("OrderId") .HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
.WithMany("OrderProducts") .WithMany("OrderProducts")
.HasForeignKey("ProductId") .HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Order"); b.Navigation("Order");
@ -1375,14 +1411,12 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand")
.WithMany("Products") .WithMany("Products")
.HasForeignKey("BrandId") .HasForeignKey("BrandId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category")
.WithMany("Products") .WithMany("Products")
.HasForeignKey("CategoryId") .HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Brand"); b.Navigation("Brand");
@ -1394,14 +1428,12 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
.WithMany("Reviews") .WithMany("Reviews")
.HasForeignKey("ProductId") .HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Product"); b.Navigation("Product");
@ -1417,8 +1449,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
.WithMany("Specifications") .WithMany("Specifications")
.HasForeignKey("ProductId") .HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Parent"); b.Navigation("Parent");
@ -1430,8 +1461,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
.WithMany("Addresses") .WithMany("Addresses")
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("User"); b.Navigation("User");
}); });
@ -1441,14 +1471,12 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
.WithMany() .WithMany()
.HasForeignKey("ProductId") .HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
.WithMany() .WithMany()
.HasForeignKey("UserId") .HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Product"); b.Navigation("Product");
@ -1460,8 +1488,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category")
.WithMany() .WithMany()
.HasForeignKey("CategoryId") .HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Category"); b.Navigation("Category");
}); });
@ -1471,8 +1498,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
.WithMany() .WithMany()
.HasForeignKey("ProductId") .HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Product"); b.Navigation("Product");
}); });
@ -1482,8 +1508,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Blogs.Blog", "Blog") b.HasOne("NetinaShop.Domain.Entities.Blogs.Blog", "Blog")
.WithMany("Files") .WithMany("Files")
.HasForeignKey("BlogId") .HasForeignKey("BlogId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Blog"); b.Navigation("Blog");
}); });
@ -1493,8 +1518,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand")
.WithMany("Files") .WithMany("Files")
.HasForeignKey("BrandId") .HasForeignKey("BrandId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Brand"); b.Navigation("Brand");
}); });
@ -1504,8 +1528,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category")
.WithMany("Files") .WithMany("Files")
.HasForeignKey("CategoryId") .HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Category"); b.Navigation("Category");
}); });
@ -1515,8 +1538,7 @@ namespace NetinaShop.Repository.Migrations
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
.WithMany("Files") .WithMany("Files")
.HasForeignKey("ProductId") .HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Restrict) .OnDelete(DeleteBehavior.Restrict);
.IsRequired();
b.Navigation("Product"); b.Navigation("Product");
}); });

View File

@ -9,22 +9,22 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="MediatR" Version="12.2.0" /> <PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="FluentValidation" Version="11.8.1" /> <PackageReference Include="FluentValidation" Version="11.9.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0"> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Pluralize.NET" Version="1.0.2" /> <PackageReference Include="Pluralize.NET" Version="1.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" /> <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
<PackageReference Include="StackExchange.Redis" Version="2.7.4" /> <PackageReference Include="StackExchange.Redis" Version="2.7.17" />
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" /> <PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -105,12 +105,12 @@ try
var price = postMetas.FirstOrDefault(pm => pm.post_id == wordPressPostDto.ID && pm.meta_key == "_price"); var price = postMetas.FirstOrDefault(pm => pm.post_id == wordPressPostDto.ID && pm.meta_key == "_price");
if (price != null && double.TryParse(price.meta_value, out double dPrice)) if (price != null && double.TryParse(price.meta_value, out double dPrice))
product = new CreateProductCommand(wordPressPostDto.post_title, string.Empty, wordPressPostDto.post_content, product = new CreateProductCommand(wordPressPostDto.post_title, string.Empty, wordPressPostDto.post_content,
wordPressPostDto.post_excerpt, string.Empty, string.Empty, true, dPrice, 0, wordPressPostDto.post_excerpt, string.Empty, string.Empty, true, dPrice, 0,10,
false,10,false,brandId, categoryId, false,10,false,brandId, categoryId,
new DiscountSDto(),new List<SpecificationSDto>(), new List<StorageFileSDto>()); new DiscountSDto(),new List<SpecificationSDto>(), new List<StorageFileSDto>());
else else
product = new CreateProductCommand(wordPressPostDto.post_title, string.Empty, wordPressPostDto.post_content, product = new CreateProductCommand(wordPressPostDto.post_title, string.Empty, wordPressPostDto.post_content,
wordPressPostDto.post_excerpt, string.Empty, string.Empty, true, 0, 0,false,10, wordPressPostDto.post_excerpt, string.Empty, string.Empty, true, 0, 0,10,false,10,
false,brandId,categoryId, false,brandId,categoryId,
new DiscountSDto(),new List<SpecificationSDto>(), new List<StorageFileSDto>()); new DiscountSDto(),new List<SpecificationSDto>(), new List<StorageFileSDto>());