public async Task <Response <int> > Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken) { var category = _mapper.Map <ProductCategory>(request); await _productCategoryRepository.AddAsync(category); return(new Response <int>(await _unitOfWork.Commit(cancellationToken))); }
public async Task <Response <ProductCategory> > Handle(CreateProductCategoryCommand request, CancellationToken cancellationToken) { var category = _mapper.Map <ProductCategory>(request); await _productCategoryRepository.AddAsync(category); var result = await _unitOfWork.Commit(cancellationToken); if (result > 0) { return(new Response <ProductCategory>(category)); } return(new Response <ProductCategory>(null)); }