chore : update dependencies

release
Amir Hossein Khademi 2024-02-07 01:12:05 +03:30
parent 7867c79cc9
commit 5355d416bf
26 changed files with 619 additions and 225 deletions

View File

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

View File

@ -0,0 +1,52 @@

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

View File

@ -11,49 +11,49 @@
</PropertyGroup>
<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>

View File

@ -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.Information)
.CreateLogger();
}
}

View File

@ -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);

View File

@ -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>

View File

@ -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,9 @@ 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<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();
}

View File

@ -1,4 +1,6 @@
namespace NetinaShop.Core.EntityServices;
using StackExchange.Redis;
namespace NetinaShop.Core.EntityServices;
public class UserService : IUserService
@ -52,14 +54,26 @@ 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
.Skip(page * 15).Take(15)
.Select(ApplicationUserMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
else
users = await _userManager.Users
.Where(a => a.PhoneNumber == phoneNumber)
.Skip(page * 15).Take(15)
.Select(ApplicationUserMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
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 +89,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 +134,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 +179,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;
}
@ -217,7 +255,7 @@ public class UserService : IUserService
return roles;
}
public async Task<RoleActionRequestDto> GetRoleAsync(Guid roleId)
public async Task<RoleActionRequestDto> GetRoleAsync(Guid roleId, CancellationToken cancellationToken = default)
{
var role = (await _roleManager.FindByIdAsync(roleId.ToString()));
if (role == null)
@ -233,7 +271,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 +291,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("لطفا نام انگلیسی را وارد کنید");
@ -288,7 +326,7 @@ public class UserService : IUserService
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)

View File

@ -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>

View File

@ -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;
}

View File

@ -2,8 +2,8 @@
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)]
[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
[AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)]
//[AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)]
[GenerateMapper]
public partial class Product : ApiEntity
{
@ -57,10 +57,10 @@ public partial class Product : ApiEntity
public int MaxOrderCount { get; internal set; }
public Guid BrandId { get; internal set; }
public Guid? BrandId { get; internal set; }
public Brand? Brand { get; internal set; }
public Guid CategoryId { get; internal set; }
public Guid? CategoryId { get; internal set; }
public ProductCategory? Category { get; internal set; }
public List<Specification> Specifications { get; internal set; } = new();

View File

@ -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++;
}

View File

@ -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)

View File

@ -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)

View File

@ -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
};
}
}

View File

@ -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++;
}

View File

@ -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;
}
}
}

View File

@ -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
@ -30,7 +33,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)
@ -58,10 +62,11 @@ 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;
}
public static Expression<Func<ProductLDto, Product>> ProjectToProduct => p13 => new Product()
public static Expression<Func<ProductLDto, Product>> ProjectLDtoToProduct => p13 => new Product()
{
PersianName = p13.PersianName,
EnglishName = p13.EnglishName,
@ -84,7 +89,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 +100,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 +114,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)
{
@ -131,7 +139,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)
@ -161,6 +170,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;
}
@ -189,7 +199,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 +210,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 +223,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 +244,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 +281,120 @@ 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 Expression<Func<ProductSDto, Product>> ProjectToProduct => p40 => new Product()
{
return p36 == null ? null : new ProductSDto()
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,
BrandId = p40.BrandId,
Brand = new Brand()
{
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
Name = p40.BrandName,
Id = p40.BrandId
},
CategoryId = p40.CategoryId,
Category = new ProductCategory()
{
Name = p40.CategoryName,
Id = p40.CategoryId
},
Id = p40.Id,
CreatedAt = p40.CreatedAt
};
public static ProductSDto AdaptToSDto(this Product p41)
{
return p41 == null ? null : new ProductSDto()
{
PersianName = p41.PersianName,
EnglishName = p41.EnglishName,
Summery = p41.Summery,
ExpertCheck = p41.ExpertCheck,
Tags = p41.Tags,
Warranty = p41.Warranty,
Cost = p41.Cost,
IsEnable = p41.IsEnable,
BeDisplayed = p41.BeDisplayed,
PackingCost = p41.PackingCost,
Rate = p41.Rate,
ReviewCount = p41.ReviewCount,
Viewed = p41.Viewed,
CategoryId = p41.CategoryId,
BrandId = p41.BrandId,
BrandName = p41.Brand != null ? p41.Brand.Name : string.Empty,
CategoryName = p41.Category != null ? p41.Category.Name : string.Empty,
Id = p41.Id,
CreatedAt = p41.CreatedAt
};
}
public static ProductSDto AdaptTo(this Product p37, ProductSDto p38)
public static ProductSDto AdaptTo(this Product p42, ProductSDto p43)
{
if (p37 == null)
if (p42 == null)
{
return null;
}
ProductSDto result = p38 ?? new ProductSDto();
ProductSDto result = p43 ?? 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 = p42.PersianName;
result.EnglishName = p42.EnglishName;
result.Summery = p42.Summery;
result.ExpertCheck = p42.ExpertCheck;
result.Tags = p42.Tags;
result.Warranty = p42.Warranty;
result.Cost = p42.Cost;
result.IsEnable = p42.IsEnable;
result.BeDisplayed = p42.BeDisplayed;
result.PackingCost = p42.PackingCost;
result.Rate = p42.Rate;
result.ReviewCount = p42.ReviewCount;
result.Viewed = p42.Viewed;
result.CategoryId = p42.CategoryId;
result.BrandId = p42.BrandId;
result.BrandName = p42.Brand != null ? p42.Brand.Name : string.Empty;
result.CategoryName = p42.Category != null ? p42.Category.Name : string.Empty;
result.Id = p42.Id;
result.CreatedAt = p42.CreatedAt;
return result;
}
public static Expression<Func<Product, ProductSDto>> ProjectToSDto => p39 => new ProductSDto()
public static Expression<Func<Product, ProductSDto>> ProjectToSDto => p44 => 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 = p44.PersianName,
EnglishName = p44.EnglishName,
Summery = p44.Summery,
ExpertCheck = p44.ExpertCheck,
Tags = p44.Tags,
Warranty = p44.Warranty,
Cost = p44.Cost,
IsEnable = p44.IsEnable,
BeDisplayed = p44.BeDisplayed,
PackingCost = p44.PackingCost,
Rate = p44.Rate,
ReviewCount = p44.ReviewCount,
Viewed = p44.Viewed,
CategoryId = p44.CategoryId,
BrandId = p44.BrandId,
BrandName = p44.Brand != null ? p44.Brand.Name : string.Empty,
CategoryName = p44.Category != null ? p44.Category.Name : string.Empty,
Id = p44.Id,
CreatedAt = p44.CreatedAt
};
private static List<Specification> funcMain1(List<SpecificationSDto> p2)
@ -356,7 +419,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 +450,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 +512,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 +543,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 +605,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 +636,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 +697,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 +728,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 +766,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;
}
}
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -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
};
}
}

View File

@ -12,8 +12,15 @@ public class MapsterRegister : IRegister
.Map("HeaderFileName", o => o.Files.Count > 0 && o.Files.Any(f => f.IsHeader) ? o.Files.FirstOrDefault(f => f.IsHeader)!.FileName : string.Empty)
.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 ? o.Category.Name : string.Empty)
.Map("BrandName", o => o.Brand != null ? o.Brand.Name : string.Empty)
.IgnoreNullValues(false)
.TwoWays();
}
}

View File

@ -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>-->

View File

@ -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>

View File

@ -44,11 +44,25 @@ public class GetProductsQueryHandler : IRequestHandler<GetProductsQuery, List<Pr
products = products.OrderByDescending(p => p.CreatedAt);
}
var productSDtos = await products.Skip(request.Page * 20)
List<ProductSDto> productSDtos = await products
.Skip(request.Page * 20)
.Take(20)
.Select(ProductMapper.ProjectToSDto)
.ToListAsync(cancellationToken);
var ptps = await products
.Skip(request.Page * 20)
.Take(20)
.ToListAsync(cancellationToken);
foreach (var product in ptps)
{
if(productSDtos.FirstOrDefault(f=>f.Id==product.Id)==null)
{
}
}
foreach (var productSDto in productSDtos)
{
double discountPrice = 0;

View File

@ -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>