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)); }
public async Task <IHttpActionResult> Put(ProductCategoryCreateOrUpdateDto input) { var result = await _service.Update(input); return(Ok(result)); }