Ejemplo n.º 1
0
        public async Task <StoreCategory> UpdateAsync(StoreCategory category, CategoryRequest request)
        {
            category.StoreCategoryName = request.CategoryName;
            var updatedCategory = _repository.Update(category);
            await _repository.SaveChangesAsync();

            return(updatedCategory);
        }
        public async Task <StoreCategoryDetailDto> Update(StoreCategoryDetailDto storeCategoryDetail)
        {
            var entity        = _mapper.Map <StoreCategoryDetail>(storeCategoryDetail);
            var modelToUpdate = await _storeCategoryRepository.FindByCondition(x => x.Id == entity.Id);

            if (!modelToUpdate.Any())
            {
                throw new ApiException("No se pudo editar el storeCategoryDetail", HttpStatusCode.NotFound);
            }
            _storeCategoryRepository.Update(entity);
            return(_mapper.Map <StoreCategoryDetailDto>(entity));
        }