Compare commits
3 Commits
7867c79cc9
...
d442ed17ee
Author | SHA1 | Date |
---|---|---|
|
d442ed17ee | |
|
70e667468d | |
|
5355d416bf |
|
@ -14,11 +14,11 @@ public class OrderBagController : ICarterModule
|
|||
.WithDisplayName("GetUserCurrentOrderBagAsync")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("add/{productId}", AddProductToBagAsync)
|
||||
group.MapPost("add", AddProductToBagAsync)
|
||||
.WithDisplayName("AddProductToBag")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
group.MapPost("remove/{productId}", RemoveFromOrderBagAsync)
|
||||
group.MapDelete("remove", RemoveFromOrderBagAsync)
|
||||
.WithDisplayName("RemoveFromOrderBag")
|
||||
.HasApiVersion(1.0);
|
||||
|
||||
|
@ -40,12 +40,12 @@ public class OrderBagController : ICarterModule
|
|||
public async Task<IResult> GetUserCurrentOrderBagAsync(IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new GetUserOrderBagQuery(), cancellationToken));
|
||||
|
||||
public async Task<IResult> AddProductToBagAsync( Guid productId, [FromQuery]int count, IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new AddToOrderBagCommand(productId,count), cancellationToken));
|
||||
public async Task<IResult> AddProductToBagAsync([FromBody] List<OrderBagRequestDto> requestDtos, IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new AddToOrderBagCommand(requestDtos), cancellationToken));
|
||||
|
||||
|
||||
public async Task<IResult> RemoveFromOrderBagAsync(Guid productId, [FromQuery] int count, IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new RemoveFromOrderBagCommand(productId, count), cancellationToken));
|
||||
public async Task<IResult> RemoveFromOrderBagAsync([FromBody] List<OrderBagRequestDto> requestDtos, IMediator mediator, CancellationToken cancellationToken)
|
||||
=> TypedResults.Ok(await mediator.Send(new RemoveFromOrderBagCommand(requestDtos), 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));
|
||||
|
|
|
@ -32,8 +32,8 @@ public class ProductController : ICarterModule
|
|||
}
|
||||
|
||||
// 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)
|
||||
=> 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));
|
||||
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, 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
|
||||
public async Task<IResult> GetAsync(Guid id, IMediator mediator,CancellationToken cancellationToken)
|
||||
|
|
|
@ -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());
|
||||
}
|
|
@ -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));
|
||||
}
|
|
@ -11,49 +11,49 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<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="Ben.BlockingDetector" Version="0.0.4" />
|
||||
<PackageReference Include="Carter" Version="8.0.0" />
|
||||
<PackageReference Include="FluentValidation" Version="11.8.1" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.1" />
|
||||
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="11.3.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
|
||||
<PackageReference Include="FluentValidation" Version="11.9.0" />
|
||||
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
|
||||
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="12.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Autofac" Version="7.1.0" />
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Autofac" 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="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.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="Microsoft.Extensions.Configuration.Abstractions" 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.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.PostgreSQL" Version="2.3.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Seq" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.ElmahIo" Version="5.0.38" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="9.1.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="9.1.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="10.2.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="10.2.0" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" 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.Drawing.Common" Version="8.0.0" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="8.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -73,6 +73,11 @@ builder.Host.ConfigureContainer<ContainerBuilder>(builder =>
|
|||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
.Build());
|
||||
|
||||
builder.RegisterMediatR(MediatRConfigurationBuilder
|
||||
.Create(typeof(CoreConfig).Assembly)
|
||||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
.Build());
|
||||
|
||||
builder.RegisterMediatR(MediatRConfigurationBuilder
|
||||
.Create(typeof(DomainConfig).Assembly)
|
||||
.WithAllOpenGenericHandlerTypesRegistered()
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using NetinaShop.Repository.Abstracts;
|
||||
using System.Security.Cryptography;
|
||||
using NetinaShop.Repository.Abstracts;
|
||||
|
||||
namespace NetinaShop.Api.Services;
|
||||
|
||||
|
@ -14,5 +15,36 @@ public class CurrentUserService : ICurrentUserService
|
|||
public string? UserId => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
public string? RoleName => _httpContextAccessor.HttpContext?.User?.FindFirstValue(ClaimTypes.Role);
|
||||
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();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -13,7 +13,7 @@ public static class LoggerConfig
|
|||
o.MinimumEventLevel = LogEventLevel.Error;
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -52,6 +52,7 @@ public static class ServiceExtensions
|
|||
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
|
||||
options.UseNpgsql(Configuration.GetConnectionString("Postgres"), b => b.MigrationsAssembly("NetinaShop.Repository"))
|
||||
.UseProjectAssembly(typeof(ApplicationUser).Assembly);
|
||||
|
||||
//options.EnableServiceProviderCaching(true);
|
||||
}).BuildServiceProvider();
|
||||
AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true);
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<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>-->
|
||||
|
||||
<PropertyGroup>
|
||||
|
@ -24,7 +24,7 @@
|
|||
<PackageReference Include="MD.PersianDateTime.Standard" Version="2.5.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<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>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
public interface IUserService : IScopedDependency
|
||||
{
|
||||
Task<ProfileResponseDto> GetUserProfileAsync(CancellationToken cancellationToken);
|
||||
Task<List<ApplicationUserSDto>> GetUsersAsync(int page = 0, CancellationToken cancellationToken = default);
|
||||
Task<ApplicationUserSDto> GetUserAsync(Guid userId);
|
||||
Task<ApplicationUser> CreateUserAsync(string phoneNumber);
|
||||
Task<List<ApplicationUserSDto>> GetUsersAsync(int page = 0,string? phoneNumber = null, CancellationToken cancellationToken = default);
|
||||
Task<ApplicationUserSDto> GetUserAsync(Guid userId, CancellationToken cancellationToken = default);
|
||||
Task<ApplicationUser> CreateUserAsync(string phoneNumber, CancellationToken cancellationToken = default);
|
||||
Task<ApplicationUser> CreateUserAsync(UserActionRequestDto request, CancellationToken cancellationToken);
|
||||
Task<bool> EditUserAsync(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<RoleActionRequestDto> GetRoleAsync(Guid roleId);
|
||||
Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request);
|
||||
Task<bool> EditRoleAsync(RoleActionRequestDto request);
|
||||
Task<bool> RemoveRoleAsync(Guid roleId);
|
||||
Task<List<ApplicationRole>> GetRolesAsync(int? page,string? roleName, CancellationToken cancellationToken = default);
|
||||
Task<RoleActionRequestDto> GetRoleAsync(Guid roleId, CancellationToken cancellationToken = default);
|
||||
Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default);
|
||||
Task<bool> EditRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default);
|
||||
Task<bool> RemoveRoleAsync(Guid roleId, CancellationToken cancellationToken = default);
|
||||
List<ClaimDto> GetPermissions();
|
||||
}
|
|
@ -20,18 +20,23 @@ public class AddToOrderBagCommandHandler : IRequestHandler<AddToOrderBagCommand,
|
|||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
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);
|
||||
|
||||
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);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
|
|
|
@ -19,18 +19,22 @@ public class RemoveFromOrderBagCommandHandler : IRequestHandler<RemoveFromOrderB
|
|||
if (!Guid.TryParse(_currentUserService.UserId, out Guid userId))
|
||||
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);
|
||||
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
|
@ -52,14 +56,37 @@ public class UserService : IUserService
|
|||
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;
|
||||
}
|
||||
|
||||
public async Task<ApplicationUserSDto> GetUserAsync(Guid userId)
|
||||
public async Task<ApplicationUserSDto> GetUserAsync(Guid userId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var user = await _userManager.FindByIdAsync(userId.ToString());
|
||||
if (user == null)
|
||||
|
@ -75,7 +102,7 @@ public class UserService : IUserService
|
|||
return dto;
|
||||
}
|
||||
|
||||
public async Task<ApplicationUser> CreateUserAsync(string phoneNumber)
|
||||
public async Task<ApplicationUser> CreateUserAsync(string phoneNumber, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var user = new ApplicationUser
|
||||
{
|
||||
|
@ -120,6 +147,16 @@ public class UserService : IUserService
|
|||
if (!result.Succeeded)
|
||||
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;
|
||||
}
|
||||
|
@ -155,6 +192,20 @@ public class UserService : IUserService
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -211,13 +262,28 @@ public class UserService : IUserService
|
|||
public async Task<List<ApplicationRole>> GetRolesAsync(int page = 0, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var roles = await _roleManager.Roles
|
||||
.Where(r=>r.Name != "RootAdmin")
|
||||
.Skip(page * 15)
|
||||
.Take(15)
|
||||
.ToListAsync(cancellationToken);
|
||||
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()));
|
||||
if (role == null)
|
||||
|
@ -233,7 +299,7 @@ public class UserService : IUserService
|
|||
return roleDto;
|
||||
}
|
||||
|
||||
public async Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request)
|
||||
public async Task<ApplicationRole> CreateRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (request.EnglishName.IsNullOrEmpty())
|
||||
throw new AppException("لطفا نام انگلیسی را وارد کنید");
|
||||
|
@ -253,7 +319,7 @@ public class UserService : IUserService
|
|||
return applicationRole;
|
||||
}
|
||||
|
||||
public async Task<bool> EditRoleAsync(RoleActionRequestDto request)
|
||||
public async Task<bool> EditRoleAsync(RoleActionRequestDto request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (request.EnglishName.IsNullOrEmpty())
|
||||
throw new AppException("لطفا نام انگلیسی را وارد کنید");
|
||||
|
@ -272,23 +338,21 @@ public class UserService : IUserService
|
|||
var roleClaims = (await _roleManager.GetClaimsAsync(applicationRole)).Where(c => c.Type == CustomClaimType.Permission).ToList();
|
||||
foreach (var roleClaim in roleClaims.ToList())
|
||||
{
|
||||
if (request.Permissions.Contains(roleClaim.Value))
|
||||
{
|
||||
roleClaims.Remove(roleClaim);
|
||||
request.Permissions.Remove(roleClaim.Value);
|
||||
}
|
||||
await _roleManager.RemoveClaimAsync(applicationRole,roleClaim);
|
||||
//if (request.Permissions.Contains(roleClaim.Value))
|
||||
//{
|
||||
// roleClaims.Remove(roleClaim);
|
||||
// request.Permissions.Remove(roleClaim.Value);
|
||||
//}
|
||||
}
|
||||
|
||||
foreach (var claim in request.Permissions)
|
||||
await _roleManager.AddClaimAsync(applicationRole, new Claim(CustomClaimType.Permission, claim));
|
||||
|
||||
foreach (var claim in roleClaims)
|
||||
await _roleManager.RemoveClaimAsync(applicationRole, claim);
|
||||
|
||||
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());
|
||||
if (applicationRole == null)
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<PackageReference Include="AspNetCoreRateLimit.Redis" Version="2.0.0" />
|
||||
<PackageReference Include="Autofac.Extras.Quartz" Version="9.0.0" />
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -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 AddToOrderBagCommand(Guid ProductId, int Count) : IRequest<bool>;
|
||||
public sealed record RemoveFromOrderBagCommand(Guid ProductId, int Count) : IRequest<bool>;
|
||||
public sealed record AddToOrderBagCommand(List<OrderBagRequestDto> RequestDtos) : IRequest<bool>;
|
||||
public sealed record RemoveFromOrderBagCommand(List<OrderBagRequestDto> RequestDtos) : 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>;
|
||||
|
|
|
@ -10,6 +10,7 @@ string Warranty,
|
|||
bool BeDisplayed,
|
||||
double Cost,
|
||||
double PackingCost,
|
||||
int Stock,
|
||||
bool HasExpressDelivery,
|
||||
int MaxOrderCount,
|
||||
bool IsSpecialOffer,
|
||||
|
@ -30,6 +31,7 @@ public sealed record UpdateProductCommand(
|
|||
bool BeDisplayed,
|
||||
double Cost,
|
||||
double PackingCost,
|
||||
int Stock,
|
||||
bool HasExpressDelivery,
|
||||
int MaxOrderCount,
|
||||
bool IsSpecialOffer,
|
||||
|
|
|
@ -5,6 +5,7 @@ public sealed record GetProductQuery(Guid Id) : IRequest<ProductLDto>;
|
|||
public sealed record GetProductsQuery(
|
||||
Guid[]? BrandIds,
|
||||
bool? IsActive,
|
||||
bool? SpecialOffer,
|
||||
int Page = 0 ,
|
||||
string? ProductName = default,
|
||||
QuerySortBy SortBy = QuerySortBy.None ,
|
||||
|
|
|
@ -13,6 +13,7 @@ public class ProductLDto : BaseDto<ProductLDto,Product>
|
|||
public int MaxOrderCount { get; set; }
|
||||
public double Cost { get; set; }
|
||||
public double PackingCost { get; set; }
|
||||
public int Stock { get; set; }
|
||||
public Guid BrandId { get; set; }
|
||||
public string BrandName { get; set; } = string.Empty;
|
||||
public Guid CategoryId { get; set; }
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
namespace NetinaShop.Domain.Dtos.RequestDtos;
|
||||
|
||||
public class OrderBagRequestDto
|
||||
{
|
||||
public Guid ProductId { get; set; }
|
||||
public int Count { get; set; }
|
||||
}
|
|
@ -20,9 +20,10 @@ public class ProductSDto : BaseDto<ProductSDto, Product>
|
|||
public float Rate { get; set; }
|
||||
public int ReviewCount { get; set; }
|
||||
public int Viewed { get; set; }
|
||||
public string MainImage { get; set; } = string.Empty;
|
||||
public Guid CategoryId { get; internal 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;
|
||||
}
|
|
@ -7,11 +7,27 @@ public partial class Product
|
|||
double cost,
|
||||
double packingCost,
|
||||
bool hasExpressDelivery,
|
||||
int stock,
|
||||
int maxOrderCount,
|
||||
Guid brandId,
|
||||
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)
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
using NetinaShop.Domain.Entities.ProductCategories;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using NetinaShop.Domain.Entities.ProductCategories;
|
||||
|
||||
namespace NetinaShop.Domain.Entities.Products;
|
||||
[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)]
|
||||
[GenerateMapper]
|
||||
public partial class Product : ApiEntity
|
||||
{
|
||||
|
@ -21,8 +23,10 @@ public partial class Product : ApiEntity
|
|||
bool beDisplayed,
|
||||
double cost,
|
||||
double packingCost,
|
||||
int stock,
|
||||
bool hasExpressDelivery,
|
||||
int maxOrderCount,
|
||||
bool isEnable,
|
||||
Guid brandId,
|
||||
Guid categoryId)
|
||||
{
|
||||
|
@ -35,8 +39,10 @@ public partial class Product : ApiEntity
|
|||
BeDisplayed = beDisplayed;
|
||||
Cost = cost;
|
||||
PackingCost = packingCost;
|
||||
Stock = stock;
|
||||
HasExpressDelivery = hasExpressDelivery;
|
||||
MaxOrderCount = maxOrderCount;
|
||||
IsEnable = isEnable;
|
||||
BrandId = brandId;
|
||||
CategoryId = categoryId;
|
||||
}
|
||||
|
@ -50,16 +56,16 @@ public partial class Product : ApiEntity
|
|||
public bool IsEnable { get; internal set; }
|
||||
public bool BeDisplayed { get; internal set; }
|
||||
public double PackingCost { get; internal set; }
|
||||
public int Stock { get; internal set; }
|
||||
public float Rate { get; internal set; }
|
||||
public int ReviewCount { get; internal set; }
|
||||
public int Viewed { get; internal set; }
|
||||
public bool HasExpressDelivery { get; internal set; }
|
||||
public int MaxOrderCount { get; internal set; }
|
||||
|
||||
|
||||
public Guid BrandId { get; internal set; }
|
||||
public Brand? Brand { get; internal set; }
|
||||
|
||||
|
||||
public Guid CategoryId { get; internal set; }
|
||||
public ProductCategory? Category { get; internal set; }
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
public enum Gender
|
||||
{
|
||||
[Display(Name = "مرد")]
|
||||
Male,
|
||||
[Display(Name = "بانو")]
|
||||
Female
|
||||
}
|
|
@ -17,7 +17,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Name = p1.Name,
|
||||
Description = p1.Description,
|
||||
Blogs = funcMain1(p1.Blogs),
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategory AdaptTo(this BlogCategoryLDto p3, BlogCategory p4)
|
||||
|
@ -32,6 +33,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Description = p3.Description;
|
||||
result.Blogs = funcMain2(p3.Blogs, result.Blogs);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -53,9 +55,11 @@ namespace NetinaShop.Domain.Mappers
|
|||
Name = p8.CategoryName,
|
||||
Id = p8.CategoryId
|
||||
},
|
||||
Id = p8.Id
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
}).ToList<Blog>(),
|
||||
Id = p7.Id
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static BlogCategoryLDto AdaptToLDto(this BlogCategory p9)
|
||||
{
|
||||
|
@ -64,7 +68,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Name = p9.Name,
|
||||
Description = p9.Description,
|
||||
Blogs = funcMain3(p9.Blogs),
|
||||
Id = p9.Id
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategoryLDto AdaptTo(this BlogCategory p11, BlogCategoryLDto p12)
|
||||
|
@ -79,6 +84,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Description = p11.Description;
|
||||
result.Blogs = funcMain6(p11.Blogs, result.Blogs);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -97,9 +103,11 @@ namespace NetinaShop.Domain.Mappers
|
|||
CategoryId = p16.CategoryId,
|
||||
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,
|
||||
Id = p16.Id
|
||||
Id = p16.Id,
|
||||
CreatedAt = p16.CreatedAt
|
||||
}).ToList<BlogSDto>(),
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
public static BlogCategory AdaptToBlogCategory(this BlogCategorySDto p17)
|
||||
{
|
||||
|
@ -107,7 +115,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
{
|
||||
Name = p17.Name,
|
||||
Description = p17.Description,
|
||||
Id = p17.Id
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategory AdaptTo(this BlogCategorySDto p18, BlogCategory p19)
|
||||
|
@ -121,6 +130,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Name = p18.Name;
|
||||
result.Description = p18.Description;
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -130,7 +140,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
{
|
||||
Name = p20.Name,
|
||||
Description = p20.Description,
|
||||
Id = p20.Id
|
||||
Id = p20.Id,
|
||||
CreatedAt = p20.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BlogCategorySDto AdaptTo(this BlogCategory p21, BlogCategorySDto p22)
|
||||
|
@ -144,6 +155,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Name = p21.Name;
|
||||
result.Description = p21.Description;
|
||||
result.Id = p21.Id;
|
||||
result.CreatedAt = p21.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -151,7 +163,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
{
|
||||
Name = p23.Name,
|
||||
Description = p23.Description,
|
||||
Id = p23.Id
|
||||
Id = p23.Id,
|
||||
CreatedAt = p23.CreatedAt
|
||||
};
|
||||
|
||||
private static List<Blog> funcMain1(List<BlogSDto> p2)
|
||||
|
@ -182,7 +195,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Name = item.CategoryName,
|
||||
Id = item.CategoryId
|
||||
},
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -218,7 +232,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Name = item.CategoryName,
|
||||
Id = item.CategoryId
|
||||
},
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -251,7 +266,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
CategoryId = item.CategoryId,
|
||||
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,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -284,7 +300,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
CategoryId = item.CategoryId,
|
||||
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,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsSuggested = p1.IsSuggested,
|
||||
CategoryId = p1.CategoryId,
|
||||
Files = funcMain1(p1.Files),
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Blog AdaptTo(this BlogLDto p3, Blog p4)
|
||||
|
@ -43,6 +44,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.CategoryId = p3.CategoryId;
|
||||
result.Files = funcMain2(p3.Files, result.Files);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -66,7 +68,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
}).ToList<BlogStorageFile>(),
|
||||
Id = p7.Id
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static BlogLDto AdaptToLDto(this Blog p9)
|
||||
{
|
||||
|
@ -81,7 +84,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
CategoryId = p9.CategoryId,
|
||||
CategoryName = p9.Category == null ? null : p9.Category.Name,
|
||||
Files = funcMain3(p9.Files),
|
||||
Id = p9.Id
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
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.Files = funcMain4(p11.Files, result.Files);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -125,7 +130,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
FileType = p16.FileType,
|
||||
Id = p16.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
public static Blog AdaptToBlog(this BlogSDto p17)
|
||||
{
|
||||
|
@ -143,7 +149,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Name = p17.CategoryName,
|
||||
Id = p17.CategoryId
|
||||
},
|
||||
Id = p17.Id
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Blog AdaptTo(this BlogSDto p18, Blog p19)
|
||||
|
@ -163,6 +170,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.CategoryId = p18.CategoryId;
|
||||
result.Category = funcMain5(new Never(), result.Category, p18);
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -179,7 +187,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
CategoryId = p22.CategoryId,
|
||||
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,
|
||||
Id = p22.Id
|
||||
Id = p22.Id,
|
||||
CreatedAt = p22.CreatedAt
|
||||
};
|
||||
}
|
||||
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.HeaderFileName = p23.Files.Count > 0 && p23.Files.Any<BlogStorageFile>(funcMain6) ? p23.Files.FirstOrDefault<BlogStorageFile>(funcMain7).FileName : string.Empty;
|
||||
result.Id = p23.Id;
|
||||
result.CreatedAt = p23.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -214,7 +224,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
CategoryId = p25.CategoryId,
|
||||
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,
|
||||
Id = p25.Id
|
||||
Id = p25.Id,
|
||||
CreatedAt = p25.CreatedAt
|
||||
};
|
||||
|
||||
private static List<BlogStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||
|
|
|
@ -19,7 +19,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
HasSpecialPage = p1.HasSpecialPage,
|
||||
PageUrl = p1.PageUrl,
|
||||
Files = funcMain1(p1.Files),
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Brand AdaptTo(this BrandLDto p3, Brand p4)
|
||||
|
@ -36,6 +37,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.PageUrl = p3.PageUrl;
|
||||
result.Files = funcMain2(p3.Files, result.Files);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -56,7 +58,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
}).ToList<BrandStorageFile>(),
|
||||
Id = p7.Id
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static BrandLDto AdaptToLDto(this Brand p9)
|
||||
{
|
||||
|
@ -67,7 +70,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
HasSpecialPage = p9.HasSpecialPage,
|
||||
PageUrl = p9.PageUrl,
|
||||
Files = funcMain3(p9.Files),
|
||||
Id = p9.Id
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
public static BrandLDto AdaptTo(this Brand p11, BrandLDto p12)
|
||||
|
@ -84,6 +88,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.PageUrl = p11.PageUrl;
|
||||
result.Files = funcMain4(p11.Files, result.Files);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -103,7 +108,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
FileType = p16.FileType,
|
||||
Id = p16.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
public static Brand AdaptToBrand(this BrandSDto p17)
|
||||
{
|
||||
|
@ -113,7 +119,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Description = p17.Description,
|
||||
HasSpecialPage = p17.HasSpecialPage,
|
||||
PageUrl = p17.PageUrl,
|
||||
Id = p17.Id
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Brand AdaptTo(this BrandSDto p18, Brand p19)
|
||||
|
@ -129,6 +136,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.HasSpecialPage = p18.HasSpecialPage;
|
||||
result.PageUrl = p18.PageUrl;
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -141,7 +149,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
HasSpecialPage = p20.HasSpecialPage,
|
||||
PageUrl = p20.PageUrl,
|
||||
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)
|
||||
|
@ -158,6 +167,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.PageUrl = p21.PageUrl;
|
||||
result.HeaderFileName = p21.Files.Count > 0 && p21.Files.Any<BrandStorageFile>(funcMain5) ? p21.Files.FirstOrDefault<BrandStorageFile>(funcMain6).FileName : string.Empty;
|
||||
result.Id = p21.Id;
|
||||
result.CreatedAt = p21.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -168,7 +178,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
HasSpecialPage = p23.HasSpecialPage,
|
||||
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,
|
||||
Id = p23.Id
|
||||
Id = p23.Id,
|
||||
CreatedAt = p23.CreatedAt
|
||||
};
|
||||
|
||||
private static List<BrandStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||
|
|
|
@ -29,7 +29,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p1.UseCount,
|
||||
IsSpecialOffer = p1.IsSpecialOffer,
|
||||
IsForInvitation = p1.IsForInvitation,
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Discount AdaptTo(this DiscountLDto p2, Discount p3)
|
||||
|
@ -58,6 +59,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.IsSpecialOffer = p2.IsSpecialOffer;
|
||||
result.IsForInvitation = p2.IsForInvitation;
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -80,7 +82,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p4.UseCount,
|
||||
IsSpecialOffer = p4.IsSpecialOffer,
|
||||
IsForInvitation = p4.IsForInvitation,
|
||||
Id = p4.Id
|
||||
Id = p4.Id,
|
||||
CreatedAt = p4.CreatedAt
|
||||
};
|
||||
public static DiscountLDto AdaptToLDto(this Discount p5)
|
||||
{
|
||||
|
@ -103,7 +106,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p5.UseCount,
|
||||
IsSpecialOffer = p5.IsSpecialOffer,
|
||||
IsForInvitation = p5.IsForInvitation,
|
||||
Id = p5.Id
|
||||
Id = p5.Id,
|
||||
CreatedAt = p5.CreatedAt
|
||||
};
|
||||
}
|
||||
public static DiscountLDto AdaptTo(this Discount p6, DiscountLDto p7)
|
||||
|
@ -132,6 +136,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.IsSpecialOffer = p6.IsSpecialOffer;
|
||||
result.IsForInvitation = p6.IsForInvitation;
|
||||
result.Id = p6.Id;
|
||||
result.CreatedAt = p6.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -154,7 +159,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p8.UseCount,
|
||||
IsSpecialOffer = p8.IsSpecialOffer,
|
||||
IsForInvitation = p8.IsForInvitation,
|
||||
Id = p8.Id
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
};
|
||||
public static Discount AdaptToDiscount(this DiscountSDto p9)
|
||||
{
|
||||
|
@ -177,7 +183,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p9.UseCount,
|
||||
IsSpecialOffer = p9.IsSpecialOffer,
|
||||
IsForInvitation = p9.IsForInvitation,
|
||||
Id = p9.Id
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Discount AdaptTo(this DiscountSDto p10, Discount p11)
|
||||
|
@ -206,6 +213,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.IsSpecialOffer = p10.IsSpecialOffer;
|
||||
result.IsForInvitation = p10.IsForInvitation;
|
||||
result.Id = p10.Id;
|
||||
result.CreatedAt = p10.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -230,7 +238,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p12.UseCount,
|
||||
IsSpecialOffer = p12.IsSpecialOffer,
|
||||
IsForInvitation = p12.IsForInvitation,
|
||||
Id = p12.Id
|
||||
Id = p12.Id,
|
||||
CreatedAt = p12.CreatedAt
|
||||
};
|
||||
}
|
||||
public static DiscountSDto AdaptTo(this Discount p13, DiscountSDto p14)
|
||||
|
@ -259,6 +268,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.IsSpecialOffer = p13.IsSpecialOffer;
|
||||
result.IsForInvitation = p13.IsForInvitation;
|
||||
result.Id = p13.Id;
|
||||
result.CreatedAt = p13.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -281,7 +291,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
UseCount = p15.UseCount,
|
||||
IsSpecialOffer = p15.IsSpecialOffer,
|
||||
IsForInvitation = p15.IsForInvitation,
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
}
|
||||
}
|
|
@ -29,7 +29,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
DiscountCode = p1.DiscountCode,
|
||||
OrderProducts = funcMain1(p1.OrderProducts),
|
||||
OrderDeliveries = funcMain2(p1.OrderDeliveries),
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
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.OrderDeliveries = funcMain4(p4.OrderDeliveries, result.OrderDeliveries);
|
||||
result.Id = p4.Id;
|
||||
result.CreatedAt = p4.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -82,7 +84,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderProductStatus = p11.OrderProductStatus,
|
||||
ProductId = p11.ProductId,
|
||||
OrderId = p11.OrderId,
|
||||
Id = p11.Id
|
||||
Id = p11.Id,
|
||||
CreatedAt = p11.CreatedAt
|
||||
}).ToList<OrderProduct>(),
|
||||
OrderDeliveries = p10.OrderDeliveries.Select<OrderDeliverySDto, OrderDelivery>(p12 => new OrderDelivery()
|
||||
{
|
||||
|
@ -92,9 +95,11 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReceiverFullName = p12.ReceiverFullName,
|
||||
ShippingId = p12.ShippingId,
|
||||
OrderId = p12.OrderId,
|
||||
Id = p12.Id
|
||||
Id = p12.Id,
|
||||
CreatedAt = p12.CreatedAt
|
||||
}).ToList<OrderDelivery>(),
|
||||
Id = p10.Id
|
||||
Id = p10.Id,
|
||||
CreatedAt = p10.CreatedAt
|
||||
};
|
||||
public static OrderLDto AdaptToLDto(this Order p13)
|
||||
{
|
||||
|
@ -115,7 +120,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
DiscountCode = p13.DiscountCode,
|
||||
OrderProducts = funcMain5(p13.OrderProducts),
|
||||
OrderDeliveries = funcMain6(p13.OrderDeliveries),
|
||||
Id = p13.Id
|
||||
Id = p13.Id,
|
||||
CreatedAt = p13.CreatedAt
|
||||
};
|
||||
}
|
||||
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.OrderDeliveries = funcMain8(p16.OrderDeliveries, result.OrderDeliveries);
|
||||
result.Id = p16.Id;
|
||||
result.CreatedAt = p16.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -168,7 +175,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderProductStatus = p23.OrderProductStatus,
|
||||
ProductId = p23.ProductId,
|
||||
OrderId = p23.OrderId,
|
||||
Id = p23.Id
|
||||
Id = p23.Id,
|
||||
CreatedAt = p23.CreatedAt
|
||||
}).ToList<OrderProductSDto>(),
|
||||
OrderDeliveries = p22.OrderDeliveries.Select<OrderDelivery, OrderDeliverySDto>(p24 => new OrderDeliverySDto()
|
||||
{
|
||||
|
@ -178,9 +186,11 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReceiverFullName = p24.ReceiverFullName,
|
||||
OrderId = p24.OrderId,
|
||||
ShippingId = p24.ShippingId,
|
||||
Id = p24.Id
|
||||
Id = p24.Id,
|
||||
CreatedAt = p24.CreatedAt
|
||||
}).ToList<OrderDeliverySDto>(),
|
||||
Id = p22.Id
|
||||
Id = p22.Id,
|
||||
CreatedAt = p22.CreatedAt
|
||||
};
|
||||
public static Order AdaptToOrder(this OrderSDto p25)
|
||||
{
|
||||
|
@ -199,7 +209,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderAt = p25.OrderAt,
|
||||
PreparingMinute = p25.PreparingMinute,
|
||||
DiscountCode = p25.DiscountCode,
|
||||
Id = p25.Id
|
||||
Id = p25.Id,
|
||||
CreatedAt = p25.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Order AdaptTo(this OrderSDto p26, Order p27)
|
||||
|
@ -224,6 +235,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.PreparingMinute = p26.PreparingMinute;
|
||||
result.DiscountCode = p26.DiscountCode;
|
||||
result.Id = p26.Id;
|
||||
result.CreatedAt = p26.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -244,7 +256,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderAt = p28.OrderAt,
|
||||
PreparingMinute = p28.PreparingMinute,
|
||||
DiscountCode = p28.DiscountCode,
|
||||
Id = p28.Id
|
||||
Id = p28.Id,
|
||||
CreatedAt = p28.CreatedAt
|
||||
};
|
||||
}
|
||||
public static OrderSDto AdaptTo(this Order p29, OrderSDto p30)
|
||||
|
@ -269,6 +282,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.PreparingMinute = p29.PreparingMinute;
|
||||
result.DiscountCode = p29.DiscountCode;
|
||||
result.Id = p29.Id;
|
||||
result.CreatedAt = p29.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -287,7 +301,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderAt = p31.OrderAt,
|
||||
PreparingMinute = p31.PreparingMinute,
|
||||
DiscountCode = p31.DiscountCode,
|
||||
Id = p31.Id
|
||||
Id = p31.Id,
|
||||
CreatedAt = p31.CreatedAt
|
||||
};
|
||||
|
||||
private static List<OrderProduct> funcMain1(List<OrderProductSDto> p2)
|
||||
|
@ -312,7 +327,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderProductStatus = item.OrderProductStatus,
|
||||
ProductId = item.ProductId,
|
||||
OrderId = item.OrderId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -342,7 +358,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReceiverFullName = item.ReceiverFullName,
|
||||
ShippingId = item.ShippingId,
|
||||
OrderId = item.OrderId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -372,7 +389,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderProductStatus = item.OrderProductStatus,
|
||||
ProductId = item.ProductId,
|
||||
OrderId = item.OrderId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -402,7 +420,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReceiverFullName = item.ReceiverFullName,
|
||||
ShippingId = item.ShippingId,
|
||||
OrderId = item.OrderId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -432,7 +451,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderProductStatus = item.OrderProductStatus,
|
||||
ProductId = item.ProductId,
|
||||
OrderId = item.OrderId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -462,7 +482,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReceiverFullName = item.ReceiverFullName,
|
||||
OrderId = item.OrderId,
|
||||
ShippingId = item.ShippingId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -492,7 +513,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
OrderProductStatus = item.OrderProductStatus,
|
||||
ProductId = item.ProductId,
|
||||
OrderId = item.OrderId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -522,7 +544,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReceiverFullName = item.ReceiverFullName,
|
||||
OrderId = item.OrderId,
|
||||
ShippingId = item.ShippingId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Mapster.Models;
|
||||
using NetinaShop.Domain.Dtos.LargDtos;
|
||||
using NetinaShop.Domain.Dtos.SmallDtos;
|
||||
using NetinaShop.Domain.Entities.ProductCategories;
|
||||
|
@ -18,7 +19,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Description = p1.Description,
|
||||
ParentId = (Guid?)p1.ParentId,
|
||||
Files = funcMain1(p1.Files),
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static ProductCategory AdaptTo(this ProductCategoryLDto p3, ProductCategory p4)
|
||||
|
@ -34,6 +36,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ParentId = (Guid?)p3.ParentId;
|
||||
result.Files = funcMain2(p3.Files, result.Files);
|
||||
result.Id = p3.Id;
|
||||
result.CreatedAt = p3.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -53,7 +56,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
}).ToList<ProductCategoryStorageFile>(),
|
||||
Id = p7.Id
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
public static ProductCategoryLDto AdaptToLDto(this ProductCategory p9)
|
||||
{
|
||||
|
@ -63,7 +67,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Description = p9.Description,
|
||||
ParentId = p9.ParentId == null ? default(Guid) : (Guid)p9.ParentId,
|
||||
Files = funcMain3(p9.Files),
|
||||
Id = p9.Id
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
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.Files = funcMain4(p11.Files, result.Files);
|
||||
result.Id = p11.Id;
|
||||
result.CreatedAt = p11.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -97,7 +103,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
FileType = p16.FileType,
|
||||
Id = p16.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
public static ProductCategory AdaptToProductCategory(this ProductCategorySDto p17)
|
||||
{
|
||||
|
@ -107,7 +114,13 @@ namespace NetinaShop.Domain.Mappers
|
|||
Description = p17.Description,
|
||||
IsMain = p17.IsMain,
|
||||
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)
|
||||
|
@ -122,47 +135,52 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Description = p18.Description;
|
||||
result.IsMain = p18.IsMain;
|
||||
result.ParentId = (Guid?)p18.ParentId;
|
||||
result.Parent = funcMain5(new Never(), result.Parent, p18);
|
||||
result.Id = p18.Id;
|
||||
result.CreatedAt = p18.CreatedAt;
|
||||
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,
|
||||
Description = p20.Description,
|
||||
IsMain = p20.IsMain,
|
||||
ParentId = p20.ParentId == null ? default(Guid) : (Guid)p20.ParentId,
|
||||
ParentName = p20.Parent == null ? null : p20.Parent.Name,
|
||||
Id = p20.Id
|
||||
Name = p22.Name,
|
||||
Description = p22.Description,
|
||||
IsMain = p22.IsMain,
|
||||
ParentId = p22.ParentId == null ? default(Guid) : (Guid)p22.ParentId,
|
||||
ParentName = p22.Parent != null ? p22.Parent.Name : string.Empty,
|
||||
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;
|
||||
}
|
||||
ProductCategorySDto result = p22 ?? new ProductCategorySDto();
|
||||
ProductCategorySDto result = p24 ?? new ProductCategorySDto();
|
||||
|
||||
result.Name = p21.Name;
|
||||
result.Description = p21.Description;
|
||||
result.IsMain = p21.IsMain;
|
||||
result.ParentId = p21.ParentId == null ? default(Guid) : (Guid)p21.ParentId;
|
||||
result.ParentName = p21.Parent == null ? null : p21.Parent.Name;
|
||||
result.Id = p21.Id;
|
||||
result.Name = p23.Name;
|
||||
result.Description = p23.Description;
|
||||
result.IsMain = p23.IsMain;
|
||||
result.ParentId = p23.ParentId == null ? default(Guid) : (Guid)p23.ParentId;
|
||||
result.ParentName = p23.Parent != null ? p23.Parent.Name : string.Empty;
|
||||
result.Id = p23.Id;
|
||||
result.CreatedAt = p23.CreatedAt;
|
||||
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,
|
||||
Description = p23.Description,
|
||||
IsMain = p23.IsMain,
|
||||
ParentId = p23.ParentId == null ? default(Guid) : (Guid)p23.ParentId,
|
||||
ParentName = p23.Parent.Name,
|
||||
Id = p23.Id
|
||||
Name = p25.Name,
|
||||
Description = p25.Description,
|
||||
IsMain = p25.IsMain,
|
||||
ParentId = p25.ParentId == null ? default(Guid) : (Guid)p25.ParentId,
|
||||
ParentName = p25.Parent != null ? p25.Parent.Name : string.Empty,
|
||||
Id = p25.Id,
|
||||
CreatedAt = p25.CreatedAt
|
||||
};
|
||||
|
||||
private static List<ProductCategoryStorageFile> funcMain1(List<StorageFileSDto> p2)
|
||||
|
@ -286,5 +304,15 @@ namespace NetinaShop.Domain.Mappers
|
|||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,8 +2,11 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using Mapster.Models;
|
||||
using NetinaShop.Domain.Dtos.LargDtos;
|
||||
using NetinaShop.Domain.Dtos.SmallDtos;
|
||||
using NetinaShop.Domain.Entities.Brands;
|
||||
using NetinaShop.Domain.Entities.ProductCategories;
|
||||
using NetinaShop.Domain.Entities.Products;
|
||||
|
||||
namespace NetinaShop.Domain.Mappers
|
||||
|
@ -23,6 +26,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
Cost = p1.Cost,
|
||||
BeDisplayed = p1.BeDisplayed,
|
||||
PackingCost = p1.PackingCost,
|
||||
Stock = p1.Stock,
|
||||
HasExpressDelivery = p1.HasExpressDelivery,
|
||||
MaxOrderCount = p1.MaxOrderCount,
|
||||
BrandId = p1.BrandId,
|
||||
|
@ -30,7 +34,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Specifications = funcMain1(p1.Specifications),
|
||||
Reviews = funcMain2(p1.Reviews),
|
||||
Files = funcMain3(p1.Files),
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Product AdaptTo(this ProductLDto p5, Product p6)
|
||||
|
@ -50,6 +55,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Cost = p5.Cost;
|
||||
result.BeDisplayed = p5.BeDisplayed;
|
||||
result.PackingCost = p5.PackingCost;
|
||||
result.Stock = p5.Stock;
|
||||
result.HasExpressDelivery = p5.HasExpressDelivery;
|
||||
result.MaxOrderCount = p5.MaxOrderCount;
|
||||
result.BrandId = p5.BrandId;
|
||||
|
@ -58,6 +64,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Reviews = funcMain5(p5.Reviews, result.Reviews);
|
||||
result.Files = funcMain6(p5.Files, result.Files);
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -72,6 +79,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
Cost = p13.Cost,
|
||||
BeDisplayed = p13.BeDisplayed,
|
||||
PackingCost = p13.PackingCost,
|
||||
Stock = p13.Stock,
|
||||
HasExpressDelivery = p13.HasExpressDelivery,
|
||||
MaxOrderCount = p13.MaxOrderCount,
|
||||
BrandId = p13.BrandId,
|
||||
|
@ -84,7 +92,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = p14.IsFeature,
|
||||
ProductId = p14.ProductId,
|
||||
ParentId = (Guid?)p14.ParentId,
|
||||
Id = p14.Id
|
||||
Id = p14.Id,
|
||||
CreatedAt = p14.CreatedAt
|
||||
}).ToList<Specification>(),
|
||||
Reviews = p13.Reviews.Select<ReviewSDto, Review>(p15 => new Review()
|
||||
{
|
||||
|
@ -94,7 +103,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = p15.IsBuyer,
|
||||
ProductId = p15.ProductId,
|
||||
UserId = p15.UserId,
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
}).ToList<Review>(),
|
||||
Files = p13.Files.Select<StorageFileSDto, ProductStorageFile>(p16 => new ProductStorageFile()
|
||||
{
|
||||
|
@ -107,7 +117,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Id = p16.Id,
|
||||
CreatedAt = p16.CreatedAt
|
||||
}).ToList<ProductStorageFile>(),
|
||||
Id = p13.Id
|
||||
Id = p13.Id,
|
||||
CreatedAt = p13.CreatedAt
|
||||
};
|
||||
public static ProductLDto AdaptToLDto(this Product p17)
|
||||
{
|
||||
|
@ -124,6 +135,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
MaxOrderCount = p17.MaxOrderCount,
|
||||
Cost = p17.Cost,
|
||||
PackingCost = p17.PackingCost,
|
||||
Stock = p17.Stock,
|
||||
BrandId = p17.BrandId,
|
||||
BrandName = p17.Brand == null ? null : p17.Brand.Name,
|
||||
CategoryId = p17.CategoryId,
|
||||
|
@ -131,7 +143,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
Specifications = funcMain7(p17.Specifications),
|
||||
Reviews = funcMain8(p17.Reviews),
|
||||
Files = funcMain9(p17.Files),
|
||||
Id = p17.Id
|
||||
Id = p17.Id,
|
||||
CreatedAt = p17.CreatedAt
|
||||
};
|
||||
}
|
||||
public static ProductLDto AdaptTo(this Product p21, ProductLDto p22)
|
||||
|
@ -153,6 +166,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.MaxOrderCount = p21.MaxOrderCount;
|
||||
result.Cost = p21.Cost;
|
||||
result.PackingCost = p21.PackingCost;
|
||||
result.Stock = p21.Stock;
|
||||
result.BrandId = p21.BrandId;
|
||||
result.BrandName = p21.Brand == null ? null : p21.Brand.Name;
|
||||
result.CategoryId = p21.CategoryId;
|
||||
|
@ -161,6 +175,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.Reviews = funcMain11(p21.Reviews, result.Reviews);
|
||||
result.Files = funcMain12(p21.Files, result.Files);
|
||||
result.Id = p21.Id;
|
||||
result.CreatedAt = p21.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -177,6 +192,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
MaxOrderCount = p29.MaxOrderCount,
|
||||
Cost = p29.Cost,
|
||||
PackingCost = p29.PackingCost,
|
||||
Stock = p29.Stock,
|
||||
BrandId = p29.BrandId,
|
||||
BrandName = p29.Brand.Name,
|
||||
CategoryId = p29.CategoryId,
|
||||
|
@ -189,7 +205,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = p30.IsFeature,
|
||||
ProductId = p30.ProductId,
|
||||
ParentId = p30.ParentId == null ? default(Guid) : (Guid)p30.ParentId,
|
||||
Id = p30.Id
|
||||
Id = p30.Id,
|
||||
CreatedAt = p30.CreatedAt
|
||||
}).ToList<SpecificationSDto>(),
|
||||
Reviews = p29.Reviews.Select<Review, ReviewSDto>(p31 => new ReviewSDto()
|
||||
{
|
||||
|
@ -199,7 +216,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = p31.IsBuyer,
|
||||
ProductId = p31.ProductId,
|
||||
UserId = p31.UserId,
|
||||
Id = p31.Id
|
||||
Id = p31.Id,
|
||||
CreatedAt = p31.CreatedAt
|
||||
}).ToList<ReviewSDto>(),
|
||||
Files = p29.Files.Select<ProductStorageFile, StorageFileSDto>(p32 => new StorageFileSDto()
|
||||
{
|
||||
|
@ -211,7 +229,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
FileType = p32.FileType,
|
||||
Id = p32.Id
|
||||
}).ToList<StorageFileSDto>(),
|
||||
Id = p29.Id
|
||||
Id = p29.Id,
|
||||
CreatedAt = p29.CreatedAt
|
||||
};
|
||||
public static Product AdaptToProduct(this ProductSDto p33)
|
||||
{
|
||||
|
@ -231,8 +250,19 @@ namespace NetinaShop.Domain.Mappers
|
|||
ReviewCount = p33.ReviewCount,
|
||||
Viewed = p33.Viewed,
|
||||
BrandId = p33.BrandId,
|
||||
Brand = new Brand()
|
||||
{
|
||||
Name = p33.BrandName,
|
||||
Id = p33.BrandId
|
||||
},
|
||||
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)
|
||||
|
@ -257,81 +287,90 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ReviewCount = p34.ReviewCount;
|
||||
result.Viewed = p34.Viewed;
|
||||
result.BrandId = p34.BrandId;
|
||||
result.Brand = funcMain13(new Never(), result.Brand, p34);
|
||||
result.CategoryId = p34.CategoryId;
|
||||
result.Category = funcMain14(new Never(), result.Category, p34);
|
||||
result.Id = p34.Id;
|
||||
result.CreatedAt = p34.CreatedAt;
|
||||
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,
|
||||
EnglishName = p36.EnglishName,
|
||||
Summery = p36.Summery,
|
||||
ExpertCheck = p36.ExpertCheck,
|
||||
Tags = p36.Tags,
|
||||
Warranty = p36.Warranty,
|
||||
Cost = p36.Cost,
|
||||
IsEnable = p36.IsEnable,
|
||||
BeDisplayed = p36.BeDisplayed,
|
||||
PackingCost = p36.PackingCost,
|
||||
Rate = p36.Rate,
|
||||
ReviewCount = p36.ReviewCount,
|
||||
Viewed = p36.Viewed,
|
||||
CategoryId = p36.CategoryId,
|
||||
BrandId = p36.BrandId,
|
||||
CategoryName = p36.Category == null ? null : p36.Category.Name,
|
||||
Id = p36.Id
|
||||
PersianName = p40.PersianName,
|
||||
EnglishName = p40.EnglishName,
|
||||
Summery = p40.Summery,
|
||||
ExpertCheck = p40.ExpertCheck,
|
||||
Tags = p40.Tags,
|
||||
Warranty = p40.Warranty,
|
||||
Cost = p40.Cost,
|
||||
IsEnable = p40.IsEnable,
|
||||
BeDisplayed = p40.BeDisplayed,
|
||||
PackingCost = p40.PackingCost,
|
||||
Rate = p40.Rate,
|
||||
ReviewCount = p40.ReviewCount,
|
||||
Viewed = p40.Viewed,
|
||||
CategoryId = p40.CategoryId,
|
||||
BrandId = p40.BrandId,
|
||||
BrandName = p40.Brand == null ? null : p40.Brand.Name,
|
||||
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;
|
||||
}
|
||||
ProductSDto result = p38 ?? new ProductSDto();
|
||||
ProductSDto result = p42 ?? new ProductSDto();
|
||||
|
||||
result.PersianName = p37.PersianName;
|
||||
result.EnglishName = p37.EnglishName;
|
||||
result.Summery = p37.Summery;
|
||||
result.ExpertCheck = p37.ExpertCheck;
|
||||
result.Tags = p37.Tags;
|
||||
result.Warranty = p37.Warranty;
|
||||
result.Cost = p37.Cost;
|
||||
result.IsEnable = p37.IsEnable;
|
||||
result.BeDisplayed = p37.BeDisplayed;
|
||||
result.PackingCost = p37.PackingCost;
|
||||
result.Rate = p37.Rate;
|
||||
result.ReviewCount = p37.ReviewCount;
|
||||
result.Viewed = p37.Viewed;
|
||||
result.CategoryId = p37.CategoryId;
|
||||
result.BrandId = p37.BrandId;
|
||||
result.CategoryName = p37.Category == null ? null : p37.Category.Name;
|
||||
result.Id = p37.Id;
|
||||
result.PersianName = p41.PersianName;
|
||||
result.EnglishName = p41.EnglishName;
|
||||
result.Summery = p41.Summery;
|
||||
result.ExpertCheck = p41.ExpertCheck;
|
||||
result.Tags = p41.Tags;
|
||||
result.Warranty = p41.Warranty;
|
||||
result.Cost = p41.Cost;
|
||||
result.IsEnable = p41.IsEnable;
|
||||
result.BeDisplayed = p41.BeDisplayed;
|
||||
result.PackingCost = p41.PackingCost;
|
||||
result.Rate = p41.Rate;
|
||||
result.ReviewCount = p41.ReviewCount;
|
||||
result.Viewed = p41.Viewed;
|
||||
result.CategoryId = p41.CategoryId;
|
||||
result.BrandId = p41.BrandId;
|
||||
result.BrandName = p41.Brand == null ? null : p41.Brand.Name;
|
||||
result.CategoryName = p41.Category == null ? null : p41.Category.Name;
|
||||
result.Id = p41.Id;
|
||||
result.CreatedAt = p41.CreatedAt;
|
||||
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,
|
||||
EnglishName = p39.EnglishName,
|
||||
Summery = p39.Summery,
|
||||
ExpertCheck = p39.ExpertCheck,
|
||||
Tags = p39.Tags,
|
||||
Warranty = p39.Warranty,
|
||||
Cost = p39.Cost,
|
||||
IsEnable = p39.IsEnable,
|
||||
BeDisplayed = p39.BeDisplayed,
|
||||
PackingCost = p39.PackingCost,
|
||||
Rate = p39.Rate,
|
||||
ReviewCount = p39.ReviewCount,
|
||||
Viewed = p39.Viewed,
|
||||
CategoryId = p39.CategoryId,
|
||||
BrandId = p39.BrandId,
|
||||
CategoryName = p39.Category.Name,
|
||||
Id = p39.Id
|
||||
PersianName = p43.PersianName,
|
||||
EnglishName = p43.EnglishName,
|
||||
Summery = p43.Summery,
|
||||
ExpertCheck = p43.ExpertCheck,
|
||||
Tags = p43.Tags,
|
||||
Warranty = p43.Warranty,
|
||||
Cost = p43.Cost,
|
||||
IsEnable = p43.IsEnable,
|
||||
BeDisplayed = p43.BeDisplayed,
|
||||
PackingCost = p43.PackingCost,
|
||||
Rate = p43.Rate,
|
||||
ReviewCount = p43.ReviewCount,
|
||||
Viewed = p43.Viewed,
|
||||
CategoryId = p43.CategoryId,
|
||||
BrandId = p43.BrandId,
|
||||
BrandName = p43.Brand == null ? null : p43.Brand.Name,
|
||||
CategoryName = p43.Category == null ? null : p43.Category.Name,
|
||||
Id = p43.Id,
|
||||
CreatedAt = p43.CreatedAt
|
||||
};
|
||||
|
||||
private static List<Specification> funcMain1(List<SpecificationSDto> p2)
|
||||
|
@ -356,7 +395,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = item.IsFeature,
|
||||
ProductId = item.ProductId,
|
||||
ParentId = (Guid?)item.ParentId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -386,7 +426,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = item.IsBuyer,
|
||||
ProductId = item.ProductId,
|
||||
UserId = item.UserId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -447,7 +488,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = item.IsFeature,
|
||||
ProductId = item.ProductId,
|
||||
ParentId = (Guid?)item.ParentId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -477,7 +519,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = item.IsBuyer,
|
||||
ProductId = item.ProductId,
|
||||
UserId = item.UserId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -538,7 +581,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = item.IsFeature,
|
||||
ProductId = item.ProductId,
|
||||
ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -568,7 +612,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = item.IsBuyer,
|
||||
ProductId = item.ProductId,
|
||||
UserId = item.UserId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -628,7 +673,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = item.IsFeature,
|
||||
ProductId = item.ProductId,
|
||||
ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -658,7 +704,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = item.IsBuyer,
|
||||
ProductId = item.ProductId,
|
||||
UserId = item.UserId,
|
||||
Id = item.Id
|
||||
Id = item.Id,
|
||||
CreatedAt = item.CreatedAt
|
||||
});
|
||||
i++;
|
||||
}
|
||||
|
@ -695,5 +742,25 @@ namespace NetinaShop.Domain.Mappers
|
|||
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;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,7 +19,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsConfirmed = p1.IsConfirmed,
|
||||
ProductId = p1.ProductId,
|
||||
UserId = p1.UserId,
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Review AdaptTo(this ReviewLDto p2, Review p3)
|
||||
|
@ -38,6 +39,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ProductId = p2.ProductId;
|
||||
result.UserId = p2.UserId;
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -50,7 +52,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsConfirmed = p4.IsConfirmed,
|
||||
ProductId = p4.ProductId,
|
||||
UserId = p4.UserId,
|
||||
Id = p4.Id
|
||||
Id = p4.Id,
|
||||
CreatedAt = p4.CreatedAt
|
||||
};
|
||||
public static ReviewLDto AdaptToLDto(this Review p5)
|
||||
{
|
||||
|
@ -63,7 +66,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsConfirmed = p5.IsConfirmed,
|
||||
ProductId = p5.ProductId,
|
||||
UserId = p5.UserId,
|
||||
Id = p5.Id
|
||||
Id = p5.Id,
|
||||
CreatedAt = p5.CreatedAt
|
||||
};
|
||||
}
|
||||
public static ReviewLDto AdaptTo(this Review p6, ReviewLDto p7)
|
||||
|
@ -82,6 +86,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ProductId = p6.ProductId;
|
||||
result.UserId = p6.UserId;
|
||||
result.Id = p6.Id;
|
||||
result.CreatedAt = p6.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -94,7 +99,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsConfirmed = p8.IsConfirmed,
|
||||
ProductId = p8.ProductId,
|
||||
UserId = p8.UserId,
|
||||
Id = p8.Id
|
||||
Id = p8.Id,
|
||||
CreatedAt = p8.CreatedAt
|
||||
};
|
||||
public static Review AdaptToReview(this ReviewSDto p9)
|
||||
{
|
||||
|
@ -106,7 +112,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = p9.IsBuyer,
|
||||
ProductId = p9.ProductId,
|
||||
UserId = p9.UserId,
|
||||
Id = p9.Id
|
||||
Id = p9.Id,
|
||||
CreatedAt = p9.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Review AdaptTo(this ReviewSDto p10, Review p11)
|
||||
|
@ -124,6 +131,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ProductId = p10.ProductId;
|
||||
result.UserId = p10.UserId;
|
||||
result.Id = p10.Id;
|
||||
result.CreatedAt = p10.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -137,7 +145,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = p12.IsBuyer,
|
||||
ProductId = p12.ProductId,
|
||||
UserId = p12.UserId,
|
||||
Id = p12.Id
|
||||
Id = p12.Id,
|
||||
CreatedAt = p12.CreatedAt
|
||||
};
|
||||
}
|
||||
public static ReviewSDto AdaptTo(this Review p13, ReviewSDto p14)
|
||||
|
@ -155,6 +164,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ProductId = p13.ProductId;
|
||||
result.UserId = p13.UserId;
|
||||
result.Id = p13.Id;
|
||||
result.CreatedAt = p13.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -166,7 +176,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsBuyer = p15.IsBuyer,
|
||||
ProductId = p15.ProductId,
|
||||
UserId = p15.UserId,
|
||||
Id = p15.Id
|
||||
Id = p15.Id,
|
||||
CreatedAt = p15.CreatedAt
|
||||
};
|
||||
}
|
||||
}
|
|
@ -9,7 +9,11 @@ namespace NetinaShop.Domain.Mappers
|
|||
{
|
||||
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)
|
||||
{
|
||||
|
@ -20,12 +24,17 @@ namespace NetinaShop.Domain.Mappers
|
|||
Shipping result = p3 ?? new Shipping();
|
||||
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
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)
|
||||
{
|
||||
|
@ -36,9 +45,14 @@ namespace NetinaShop.Domain.Mappers
|
|||
ShippingSDto result = p6 ?? new ShippingSDto();
|
||||
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
|
@ -17,7 +17,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = p1.IsFeature,
|
||||
ProductId = p1.ProductId,
|
||||
ParentId = (Guid?)p1.ParentId,
|
||||
Id = p1.Id
|
||||
Id = p1.Id,
|
||||
CreatedAt = p1.CreatedAt
|
||||
};
|
||||
}
|
||||
public static Specification AdaptTo(this SpecificationSDto p2, Specification p3)
|
||||
|
@ -35,6 +36,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ProductId = p2.ProductId;
|
||||
result.ParentId = (Guid?)p2.ParentId;
|
||||
result.Id = p2.Id;
|
||||
result.CreatedAt = p2.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -48,7 +50,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = p4.IsFeature,
|
||||
ProductId = p4.ProductId,
|
||||
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)
|
||||
|
@ -66,6 +69,7 @@ namespace NetinaShop.Domain.Mappers
|
|||
result.ProductId = p5.ProductId;
|
||||
result.ParentId = p5.ParentId == null ? default(Guid) : (Guid)p5.ParentId;
|
||||
result.Id = p5.Id;
|
||||
result.CreatedAt = p5.CreatedAt;
|
||||
return result;
|
||||
|
||||
}
|
||||
|
@ -77,7 +81,8 @@ namespace NetinaShop.Domain.Mappers
|
|||
IsFeature = p7.IsFeature,
|
||||
ProductId = p7.ProductId,
|
||||
ParentId = p7.ParentId == null ? default(Guid) : (Guid)p7.ParentId,
|
||||
Id = p7.Id
|
||||
Id = p7.Id,
|
||||
CreatedAt = p7.CreatedAt
|
||||
};
|
||||
}
|
||||
}
|
|
@ -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)
|
||||
.TwoWays();
|
||||
|
||||
config.NewConfig<ProductCategory, ProductSDto>()
|
||||
config.NewConfig<ProductCategory, ProductCategorySDto>()
|
||||
.Map("ParentName", o => o.Parent != null ? o.Parent.Name : string.Empty)
|
||||
.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();
|
||||
|
||||
}
|
||||
}
|
|
@ -7,146 +7,173 @@ public static class ApplicationClaims
|
|||
|
||||
public static ClaimDto ManageBlogs { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت بلاگ ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageBlogs,
|
||||
};
|
||||
public static ClaimDto ViewBlogs { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده بلاگ ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewBlogs,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageBrands { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت برند ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageBrands,
|
||||
};
|
||||
public static ClaimDto ViewBrands { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده برند ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewBrands,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageCategories { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت دسته بندی ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageCategories,
|
||||
};
|
||||
public static ClaimDto ViewCategories { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده دسته بندی ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewCategories,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageDiscounts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت تخفیف ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageDiscounts,
|
||||
};
|
||||
public static ClaimDto ViewDiscounts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده تخفیف ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewDiscounts,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageOrders { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت فروش ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageOrders,
|
||||
};
|
||||
public static ClaimDto ViewAllOrders { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده فروش ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewAllOrders,
|
||||
};
|
||||
public static ClaimDto ViewMineOrders { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده فروش های خود",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewMineOrders,
|
||||
};
|
||||
public static ClaimDto CreateOrder { get; } = new ClaimDto
|
||||
{
|
||||
Title = "ثبت سفارش",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.CreateOrder,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageProducts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت محصولات",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageProducts,
|
||||
};
|
||||
public static ClaimDto ViewProducts { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده محصولات",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewProducts,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageReview { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت کامنت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageReview,
|
||||
};
|
||||
public static ClaimDto ViewAllReviews { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده کامنت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewAllReviews,
|
||||
};
|
||||
public static ClaimDto ViewMineReviews { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده کامنت های خود",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewMineReviews,
|
||||
};
|
||||
public static ClaimDto AddReview { get; } = new ClaimDto
|
||||
{
|
||||
Title = "ثبت کامنت جدید",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.AddReview,
|
||||
};
|
||||
public static ClaimDto ConfirmReview { get; } = new ClaimDto
|
||||
{
|
||||
Title = "تائید کامنت ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ConfirmReview,
|
||||
};
|
||||
|
||||
public static ClaimDto ViewWarehouses { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده انبار ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewWarehouses,
|
||||
};
|
||||
public static ClaimDto ManageWarehouses { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت انبار ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageWarehouses,
|
||||
};
|
||||
|
||||
public static ClaimDto ViewShipping { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده روش های ارسال",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewShipping,
|
||||
};
|
||||
public static ClaimDto ManageShipping { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت روش های ارسال",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageShipping,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageUsers { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت کاربران",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageUsers,
|
||||
};
|
||||
public static ClaimDto ViewUsers { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده کاربران",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewUsers,
|
||||
};
|
||||
|
||||
public static ClaimDto ManageFiles { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مدیریت فایل ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ManageFiles,
|
||||
};
|
||||
public static ClaimDto ViewFiles { get; } = new ClaimDto
|
||||
{
|
||||
Title = "مشاهده فایل ها",
|
||||
Type = CustomClaimType.Permission,
|
||||
Value = ApplicationPermission.ViewFiles,
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
<PackageReference Include="Mapster.Core" Version="1.2.1" />
|
||||
<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" />
|
||||
</ItemGroup>-->
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
|
||||
<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" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -5,5 +5,7 @@ public interface ICurrentUserService : IScopedDependency
|
|||
string? UserId { get; }
|
||||
string? RoleName { get; }
|
||||
string? UserName { get; }
|
||||
string? DeviceId { get; }
|
||||
bool IsAuthorized { get; }
|
||||
public List<string>? Permissions { get; }
|
||||
}
|
|
@ -79,7 +79,10 @@ public static class ModelBuilderExtensions
|
|||
.SelectMany(t => t.GetForeignKeys())
|
||||
.Where(fk => !fk.IsOwnership && fk.DeleteBehavior == DeleteBehavior.Cascade);
|
||||
foreach (var fk in cascadeFKs)
|
||||
{
|
||||
fk.DeleteBehavior = DeleteBehavior.Restrict;
|
||||
fk.IsRequired = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -97,13 +100,13 @@ public static class ModelBuilderExtensions
|
|||
.Where(c => c.IsClass && !c.IsAbstract && c.IsPublic);
|
||||
|
||||
foreach (var type in types)
|
||||
foreach (var iface in type.GetInterfaces())
|
||||
if (iface.IsConstructedGenericType &&
|
||||
iface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>))
|
||||
{
|
||||
var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(iface.GenericTypeArguments[0]);
|
||||
applyConcreteMethod.Invoke(modelBuilder, new[] { Activator.CreateInstance(type) });
|
||||
}
|
||||
foreach (var iface in type.GetInterfaces())
|
||||
if (iface.IsConstructedGenericType &&
|
||||
iface.GetGenericTypeDefinition() == typeof(IEntityTypeConfiguration<>))
|
||||
{
|
||||
var applyConcreteMethod = applyGenericMethod.MakeGenericMethod(iface.GenericTypeArguments[0]);
|
||||
applyConcreteMethod.Invoke(modelBuilder, new[] { Activator.CreateInstance(type) });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,11 +140,8 @@ public static class ModelBuilderExtensions
|
|||
var builderQueryFilter = new ModelBuilderQueryFilter();
|
||||
foreach (var type in types)
|
||||
{
|
||||
var stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
modelBuilder.Entity(type);
|
||||
builderQueryFilter.AddQueryFilterToModelBuilder(modelBuilder, type);
|
||||
stopwatch.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ public static class ModelBuilderExtensions
|
|||
var onModelCreatingMethod =
|
||||
type.GetMethods().FirstOrDefault(x => x.Name == "OnModelCreating");
|
||||
|
||||
if (onModelCreatingMethod != null)
|
||||
if (onModelCreatingMethod != null)
|
||||
onModelCreatingMethod.Invoke(type, new object[] { builder });
|
||||
else
|
||||
{
|
||||
|
@ -176,7 +176,7 @@ public static class ModelBuilderExtensions
|
|||
var baseOnModelCreatingMethod = type.BaseType.GetMethods()
|
||||
.FirstOrDefault(x => x.Name == "OnModelCreating");
|
||||
|
||||
if (baseOnModelCreatingMethod == null)
|
||||
if (baseOnModelCreatingMethod == null)
|
||||
continue;
|
||||
|
||||
baseOnModelCreatingMethod.Invoke(typeof(BaseType), new object[] { builder });
|
||||
|
|
|
@ -18,7 +18,7 @@ public class GetBrandsQueryHandler : IRequestHandler<GetBrandsQuery, List<BrandS
|
|||
List<BrandSDto> brands = new List<BrandSDto>();
|
||||
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);
|
||||
var brandGrouped = products.GroupBy(p => p.BrandId);
|
||||
foreach (var grouping in brandGrouped)
|
||||
|
|
|
@ -38,7 +38,7 @@ public class UpdateDiscountCommandHandler : IRequestHandler<UpdateDiscountComman
|
|||
break;
|
||||
|
||||
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)
|
||||
throw new AppException("Discount not found", ApiResultStatusCode.NotFound);
|
||||
|
||||
|
|
|
@ -14,7 +14,10 @@ public class CreateProductCommandHandler : IRequestHandler<CreateProductCommand,
|
|||
public async Task<ProductLDto> Handle(CreateProductCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
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);
|
||||
|
||||
foreach (var specification in request.Specifications)
|
||||
|
|
|
@ -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>>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
private readonly IMediator _mediator;
|
||||
|
||||
public GetProductsQueryHandler(IRepositoryWrapper repositoryWrapper,IMediator mediator)
|
||||
public GetProductsQueryHandler(IRepositoryWrapper repositoryWrapper, IMediator mediator)
|
||||
{
|
||||
_repositoryWrapper = repositoryWrapper;
|
||||
_mediator = mediator;
|
||||
|
@ -14,7 +17,7 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
|
|||
{
|
||||
var products = _repositoryWrapper.SetRepository<Product>().TableNoTracking;
|
||||
if (request.IsActive != null)
|
||||
products = products.Where(p => p.IsEnable == request.IsActive );
|
||||
products = products.Where(p => p.IsEnable == request.IsActive);
|
||||
if (request.ProductName != null)
|
||||
products = products.Where(p => p.PersianName.ToLower().Trim().Contains(request.ProductName.ToLower().Trim()));
|
||||
if (request.CategoryId != default)
|
||||
|
@ -44,7 +47,22 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
|
|||
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)
|
||||
.Select(ProductMapper.ProjectToSDto)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
@ -55,7 +73,7 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
|
|||
productSDto.CostWithDiscount = productSDto.Cost;
|
||||
var categoryDiscount = await _repositoryWrapper.SetRepository<CategoryDiscount>()
|
||||
.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())
|
||||
{
|
||||
|
@ -69,7 +87,7 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
|
|||
|
||||
var productDiscount = await _repositoryWrapper.SetRepository<ProductDiscount>()
|
||||
.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)
|
||||
.FirstOrDefaultAsync(cancellationToken);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ public class UpdateProductCommandHandler : IRequestHandler<UpdateProductCommand,
|
|||
request.Cost,
|
||||
request.PackingCost,
|
||||
request.HasExpressDelivery,
|
||||
request.Stock,
|
||||
request.MaxOrderCount,
|
||||
request.BrandId,
|
||||
request.CategoryId);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
1609
NetinaShop.Repository/Migrations/20240208123658_EditOrderAddDeviceId.Designer.cs
generated
100644
1609
NetinaShop.Repository/Migrations/20240208123658_EditOrderAddDeviceId.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
1608
NetinaShop.Repository/Migrations/20240208150343_EditOrderNullUserId.Designer.cs
generated
100644
1608
NetinaShop.Repository/Migrations/20240208150343_EditOrderNullUserId.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -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
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
1608
NetinaShop.Repository/Migrations/20240209142029_EditProductIsEnable.Designer.cs
generated
100644
1608
NetinaShop.Repository/Migrations/20240209142029_EditProductIsEnable.Designer.cs
generated
100644
File diff suppressed because it is too large
Load Diff
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -18,7 +18,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("public")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("ProductVersion", "8.0.1")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
@ -143,6 +143,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -155,6 +156,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ReadingTime")
|
||||
|
@ -164,6 +166,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Summery")
|
||||
|
@ -195,6 +198,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -208,6 +212,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -218,6 +223,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -235,6 +241,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -251,6 +258,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -265,6 +273,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -292,6 +301,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("DiscountAmount")
|
||||
|
@ -333,6 +343,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<long>("PriceCeiling")
|
||||
|
@ -345,6 +356,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("StartDate")
|
||||
|
@ -375,6 +387,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("DeliveryPrice")
|
||||
|
@ -403,6 +416,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("OrderAt")
|
||||
|
@ -427,6 +441,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("ServicePrice")
|
||||
|
@ -467,6 +482,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("DeliveryCost")
|
||||
|
@ -479,6 +495,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
|
@ -500,6 +517,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ShippingId")
|
||||
|
@ -527,6 +545,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -536,6 +555,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OrderId")
|
||||
|
@ -566,6 +586,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -587,6 +608,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
|
@ -603,6 +625,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -616,6 +639,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -647,6 +671,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EnglishName")
|
||||
|
@ -673,6 +698,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("PackingCost")
|
||||
|
@ -689,11 +715,15 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ReviewCount")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("Stock")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Summery")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
@ -732,6 +762,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsBuyer")
|
||||
|
@ -747,6 +778,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
|
@ -759,6 +791,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
|
@ -787,6 +820,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Detail")
|
||||
|
@ -803,6 +837,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("ParentId")
|
||||
|
@ -815,6 +850,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
|
@ -844,6 +880,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
|
@ -875,6 +912,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
|
@ -885,6 +923,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
@ -1035,6 +1074,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -1050,6 +1090,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PostalCode")
|
||||
|
@ -1068,6 +1109,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
|
@ -1090,6 +1132,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsRemoved")
|
||||
|
@ -1099,6 +1142,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ProductId")
|
||||
|
@ -1108,6 +1152,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("UserId")
|
||||
|
@ -1132,6 +1177,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("CreatedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<double>("DeliveryCost")
|
||||
|
@ -1153,12 +1199,14 @@ namespace NetinaShop.Repository.Migrations
|
|||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("ModifiedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTime>("RemovedAt")
|
||||
.HasColumnType("timestamp without time zone");
|
||||
|
||||
b.Property<string>("RemovedBy")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Title")
|
||||
|
@ -1251,8 +1299,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
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)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
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)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
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)
|
||||
.WithMany()
|
||||
.HasForeignKey("RoleId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
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)
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b =>
|
||||
|
@ -1302,8 +1344,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category")
|
||||
.WithMany("Blogs")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
});
|
||||
|
@ -1317,8 +1358,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
@ -1328,14 +1368,12 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order")
|
||||
.WithMany("OrderDeliveries")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping")
|
||||
.WithMany()
|
||||
.HasForeignKey("ShippingId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
|
@ -1347,14 +1385,12 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order")
|
||||
.WithMany("OrderProducts")
|
||||
.HasForeignKey("OrderId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
|
||||
.WithMany("OrderProducts")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Order");
|
||||
|
||||
|
@ -1375,14 +1411,12 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
||||
.WithMany("Products")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Brand");
|
||||
|
||||
|
@ -1394,14 +1428,12 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
|
||||
.WithMany("Reviews")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
|
@ -1417,8 +1449,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
|
||||
.WithMany("Specifications")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
|
@ -1430,8 +1461,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany("Addresses")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
@ -1441,14 +1471,12 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Product");
|
||||
|
||||
|
@ -1460,8 +1488,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
||||
.WithMany()
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
});
|
||||
|
@ -1471,8 +1498,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
|
||||
.WithMany()
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
@ -1482,8 +1508,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Blogs.Blog", "Blog")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("BlogId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Blog");
|
||||
});
|
||||
|
@ -1493,8 +1518,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("BrandId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Brand");
|
||||
});
|
||||
|
@ -1504,8 +1528,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("CategoryId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Category");
|
||||
});
|
||||
|
@ -1515,8 +1538,7 @@ namespace NetinaShop.Repository.Migrations
|
|||
b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product")
|
||||
.WithMany("Files")
|
||||
.HasForeignKey("ProductId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
.OnDelete(DeleteBehavior.Restrict);
|
||||
|
||||
b.Navigation("Product");
|
||||
});
|
||||
|
|
|
@ -9,22 +9,22 @@
|
|||
|
||||
<ItemGroup>
|
||||
<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.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.1" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Pluralize.NET" Version="1.0.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.4" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="9.1.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.1" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.17" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="10.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -105,12 +105,12 @@ try
|
|||
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))
|
||||
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,
|
||||
new DiscountSDto(),new List<SpecificationSDto>(), new List<StorageFileSDto>());
|
||||
else
|
||||
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,
|
||||
new DiscountSDto(),new List<SpecificationSDto>(), new List<StorageFileSDto>());
|
||||
|
||||
|
|
Loading…
Reference in New Issue