Esempio n. 1
0
 public async Task <IActionResult> Edit(ManufacturerEditDto dto)
 {
     if (ModelState.IsValid)
     {
         memoryCache.Remove(GlobalConstants.CasheManufactorersInButtonName);
         if (await manufacturersService.NameTaken(dto.Name, dto.Id))
         {
             ModelState.AddModelError("Name", $"Name {dto.Name} is already used!");
             return(View(dto));
         }
         manufacturersService.EditManufacturer(dto);
         return(RedirectToAction(nameof(Manage)));
     }
     return(View(dto));
 }