public async Task <IActionResult> PutSubCategory(int id, SubCategoryDto subCategoryDto) { if (id != subCategoryDto.Id) { return(BadRequest()); } var subCategory = _mapper.Map <SubCategory>(subCategoryDto); var updated = await _repo.Update(subCategory); if (updated) { return(Ok("Updated")); } else { return(BadRequest("Could not update")); } }
public IActionResult Update(SubCategoryViewModel vm) { subCatrepo.Update(vm); return(RedirectToAction(nameof(Index))); }