public IActionResult AddCpu(CpuDto cpu) { if (ModelState.IsValid) { componentService.CreateCPU(cpu); return(RedirectToAction(nameof(AddCpu))); } return(View()); }
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()); }