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 modelrelease
parent
cc004f84be
commit
de7a70c6c9
|
@ -79,13 +79,13 @@ public class SeedController : ICarterModule
|
|||
true,
|
||||
default,
|
||||
new List<StorageFileSDto>()),cancellationToken);
|
||||
categories.Add(0,baseCat.Id);
|
||||
categories.Add(0,baseCat);
|
||||
foreach (var requestDto in request)
|
||||
{
|
||||
var lDto = await mediator.Send(new CreateProductCategoryCommand(requestDto.Name,requestDto.Description,true,default,
|
||||
|
||||
new List<StorageFileSDto>()), cancellationToken);
|
||||
categories.Add(requestDto.BaseCategoryId,lDto.Id);
|
||||
categories.Add(requestDto.BaseCategoryId,lDto);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ public sealed record CreateProductCategoryCommand(
|
|||
string Description,
|
||||
bool IsMain,
|
||||
Guid ParentId,
|
||||
List<StorageFileSDto> Files) : IRequest<ProductCategoryLDto>;
|
||||
List<StorageFileSDto> Files) : IRequest<Guid>;
|
||||
|
||||
public sealed record UpdateProductCategoryCommand(
|
||||
Guid Id,
|
||||
|
|
|
@ -11,4 +11,8 @@ public class ProductCategorySDto : BaseDto<ProductCategorySDto , ProductCategory
|
|||
public string MainImage { get; set; } = string.Empty;
|
||||
|
||||
public List<ProductCategorySDto> Children { get; set; } = new();
|
||||
|
||||
public int Index { get; set; }
|
||||
public bool IsSelected { get; set; }
|
||||
public bool AddNewCatVisibility { get; set; }
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
namespace Netina.Repository.Handlers.ProductCategories;
|
||||
|
||||
public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,ProductCategoryLDto>
|
||||
public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProductCategoryCommand,Guid>
|
||||
{
|
||||
private readonly IRepositoryWrapper _repositoryWrapper;
|
||||
|
||||
|
@ -9,7 +9,7 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
|
|||
_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);
|
||||
if (request.ParentId != default)
|
||||
|
@ -20,6 +20,6 @@ public class CreateProductCategoryCommandHandler : IRequestHandler<CreateProduct
|
|||
}
|
||||
_repositoryWrapper.SetRepository<ProductCategory>().Add(ent);
|
||||
await _repositoryWrapper.SaveChangesAsync(cancellationToken);
|
||||
return ent.AdaptToLDto();
|
||||
return ent.Id;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue