Пример #1
0
        public async Task <ProductCategoryDto> Create(ProductCategoryCreateOrUpdateDto input)
        {
            var entity = input.MapTo <Eron.Core.Entities.Financial.Shop.ProductCategory>();

            entity.Slug = entity.Slug.IsPopulated() ? entity.Slug.Slugify() : entity.Title.Slugify();
            var result = UnitOfWork.ProductCategoryRepository.Create(entity);
            await UnitOfWork.SaveAsync();

            return(result.MapTo <ProductCategoryDto>());
        }
Пример #2
0
        public async Task <ProductCategoryDto> Update(ProductCategoryCreateOrUpdateDto input)
        {
            if (!input.IsUpdateEntry())
            {
                throw new EntityNotFoundException();
            }

            var entity = input.MapTo <Eron.Core.Entities.Financial.Shop.ProductCategory>();

            UnitOfWork.ProductCategoryRepository.Update(entity);
            await UnitOfWork.SaveAsync();

            return(entity.MapTo <ProductCategoryDto>());
        }
Пример #3
0
        public async Task <IHttpActionResult> Put(ProductCategoryCreateOrUpdateDto input)
        {
            var result = await _service.Update(input);

            return(Ok(result));
        }