refactor(ProductCategoriesPage) , refactor(ICrudApiRest)

- NEW VERSION OF PRODUCT CATEGORIES PAGE
- Change products categories page style and ux
- Change icrud api rest and get guid in instead of dto or model
release
Amir Hossein Khademi 2024-06-07 23:03:54 +03:30
parent cc004f84be
commit de7a70c6c9
4 changed files with 10 additions and 6 deletions

View File

@ -79,13 +79,13 @@ public class SeedController : ICarterModule
true, true,
default, default,
new List<StorageFileSDto>()),cancellationToken); new List<StorageFileSDto>()),cancellationToken);
categories.Add(0,baseCat.Id); categories.Add(0,baseCat);
foreach (var requestDto in request) foreach (var requestDto in request)
{ {
var lDto = await mediator.Send(new CreateProductCategoryCommand(requestDto.Name,requestDto.Description,true,default, var lDto = await mediator.Send(new CreateProductCategoryCommand(requestDto.Name,requestDto.Description,true,default,
new List<StorageFileSDto>()), cancellationToken); new List<StorageFileSDto>()), cancellationToken);
categories.Add(requestDto.BaseCategoryId,lDto.Id); categories.Add(requestDto.BaseCategoryId,lDto);
} }

View File

@ -5,7 +5,7 @@ public sealed record CreateProductCategoryCommand(
string Description, string Description,
bool IsMain, bool IsMain,
Guid ParentId, Guid ParentId,
List<StorageFileSDto> Files) : IRequest<ProductCategoryLDto>; List<StorageFileSDto> Files) : IRequest<Guid>;
public sealed record UpdateProductCategoryCommand( public sealed record UpdateProductCategoryCommand(
Guid Id, Guid Id,

View File

@ -11,4 +11,8 @@ public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory
public string MainImage { get; set; } = string.Empty; public string MainImage { get; set; } = string.Empty;
public List<ProductCategorySDto> Children { get; set; } = new(); public List<ProductCategorySDto> Children { get; set; } = new();
public int Index { get; set; }
public bool IsSelected { get; set; }
public bool AddNewCatVisibility { get; set; }
} }

View File

@ -1,6 +1,6 @@
namespace Netina.Repository.Handlers.ProductCategories; namespace Netina.Repository.Handlers.ProductCategories;
public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,ProductCategoryLDto> public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,Guid>
{ {
private readonly IRepositoryWrapper _repositoryWrapper; private readonly IRepositoryWrapper _repositoryWrapper;
@ -9,7 +9,7 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
_repositoryWrapper = repositoryWrapper; _repositoryWrapper = repositoryWrapper;
} }
public async Task<ProductCategoryLDto> Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken) public async Task<Guid> Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken)
{ {
var ent = ProductCategory.Create(request.Name, request.Description, request.IsMain); var ent = ProductCategory.Create(request.Name, request.Description, request.IsMain);
if (request.ParentId != default) if (request.ParentId != default)
@ -20,6 +20,6 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
} }
_repositoryWrapper.SetRepository<ProductCategory>().Add(ent); _repositoryWrapper.SetRepository<ProductCategory>().Add(ent);
await _repositoryWrapper.SaveChangesAsync(cancellationToken); await _repositoryWrapper.SaveChangesAsync(cancellationToken);
return ent.AdaptToLDto(); return ent.Id;
} }
} }