示例#1
0
        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);
            }
        }
示例#3
0
 public async Task <int> CreateAsync(ProductCategoryRequest request)
 {
     return(await _productCategoryRepository.CreateAsync(request));
 }
示例#4
0
 public async Task <ProductCategoryDto> CreateAsync(ProductCategoryDto productCategoryDto)
 {
     return(await _productCategoryRepository.CreateAsync(productCategoryDto));
 }