Пример #1
0
        public IActionResult UpdateData(EditProductCategoryViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            var dto = _mapper.Map <EditProductCategoryViewModel, ProductCategoryDTO>(viewModel);

            if (!_appService.Update(dto))
            {
                return(BadRequest());
            }

            var fullTree = _appService.GetFullTree().ToList();

            ViewProductCategoryViewModel newViewModel = new ViewProductCategoryViewModel {
                SelectedProductCategoryId = dto.Id
            };

            newViewModel.ProductCategories = _mapper.Map <IList <ProductCategoryDTO>, IList <ProductCategoryViewModel> >(fullTree);

            return(PartialView("_TreePartial", newViewModel));
        }
Пример #2
0
        public async Task <IHttpActionResult> Put(ProductCategoryCreateOrUpdateDto input)
        {
            var result = await _service.Update(input);

            return(Ok(result));
        }