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