Beispiel #1
0
 public IActionResult AddPcStorage(PcStorageDto storage)
 {
     if (ModelState.IsValid)
     {
         componentService.CreatePcStorage(storage);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(AddPcStorage()));
 }
Beispiel #2
0
 public IActionResult AddPcStorage(PcStorageDto storage)
 {
     if (ModelState.IsValid)
     {
         if (componentService.HasTheSameIdInBase(storage.model))
         {
             return(NotFound("A storage with the same model already exits"));
         }
         componentService.CreatePcStorage(storage);
         return(RedirectToAction(nameof(AddPcStorage)));
     }
     return(View(AddPcStorage()));
 }