Esempio n. 1
0
 public IActionResult AddMotherboard(MotherboardDto motherboard)
 {
     if (ModelState.IsValid)
     {
         componentService.CreateMotherboard(motherboard);
         return(RedirectToAction(nameof(motherboard)));
     }
     return(View());
 }
 public IActionResult AddMotherboard(MotherboardDto motherboard)
 {
     if (ModelState.IsValid)
     {
         if (componentService.HasTheSameIdInBase(motherboard.model))
         {
             return(NotFound("A motherboard with the same model already exits"));
         }
         componentService.CreateMotherboard(motherboard);
         return(RedirectToAction(nameof(ShowMotherboards)));
     }
     return(View());
 }