public IActionResult AddPcCase(PcCaseDto pcCase) { if (ModelState.IsValid) { componentService.CreatePcCase(pcCase); return(RedirectToAction(nameof(AddPcCase))); } else { return(View("The component exists")); } }
public IActionResult AddPcCase(PcCaseDto pcCase) { if (ModelState.IsValid) { if (componentService.HasTheSameIdInBase(pcCase.model)) { return(NotFound("A case with the same model already exits")); } componentService.CreatePcCase(pcCase); return(RedirectToAction(nameof(AddPcCase))); } return(View()); }