public IActionResult AddPcStorage(PcStorageDto storage) { if (ModelState.IsValid) { componentService.CreatePcStorage(storage); return(RedirectToAction(nameof(Index))); } return(View(AddPcStorage())); }
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())); }