public ActionResult Edit(Disease disease) { if (repo.AlreadyExists(disease)) { ModelState.AddModelError(nameof(disease.Name), "Disease with name and code already exists"); } if (ModelState.IsValid) { repo.UpdateDisease(disease); return(RedirectToAction("Index")); } return(View(disease)); }
public void UpdateDisease(Disease disease) { _diseaseRepository.UpdateDisease(disease); }