public async Task <OperationResult <ProductCategoryDto> > CreateAsync(CreateProductCategoryInput input) { var validationResult = await _productCategoryValidator.ValidateCreateProductCategory(input); if (validationResult.IsSuccess) { var entity = input.ConvertToEntity(); entity = await _productCategoryRepository.CreateAsync(entity); return(OperationResult <ProductCategoryDto> .Success(entity.ConvertToDto(0))); } return(OperationResult <ProductCategoryDto> .Fail(validationResult)); }
public async Task <ServiceResponeCode> CreateAsync(ProductCategory entityToCreate) { if (entityToCreate.Id != 0) { return(ServiceResponeCode.INVALID); } try { await _productCategoryRepository.CreateAsync(entityToCreate); return(ServiceResponeCode.OK); } catch { return(ServiceResponeCode.ERROR); } }
public async Task <int> CreateAsync(ProductCategoryRequest request) { return(await _productCategoryRepository.CreateAsync(request)); }
public async Task <ProductCategoryDto> CreateAsync(ProductCategoryDto productCategoryDto) { return(await _productCategoryRepository.CreateAsync(productCategoryDto)); }