Beispiel #1
0
 public IActionResult AddCpu(CpuDto cpu)
 {
     if (ModelState.IsValid)
     {
         componentService.CreateCPU(cpu);
         return(RedirectToAction(nameof(AddCpu)));
     }
     return(View());
 }
Beispiel #2
0
 public IActionResult AddCpu(CpuDto cpu)
 {
     if (ModelState.IsValid)
     {
         if (componentService.HasTheSameIdInBase(cpu.model))
         {
             return(NotFound("A processor with the same model already exits"));
         }
         componentService.CreateCPU(cpu);
         return(RedirectToAction(nameof(AddCpu)));
     }
     return(View());
 }