示例#1
0
        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"));
            }
        }
示例#2
0
 public IActionResult Update(SubCategoryViewModel vm)
 {
     subCatrepo.Update(vm);
     return(RedirectToAction(nameof(Index)));
 }