예제 #1
0
 public ActionResult Create(Disease disease)
 {
     if (repo.AlreadyExists(disease))
     {
         ModelState.AddModelError(nameof(disease.Name), "Disease with name and code already exists");
     }
     if (ModelState.IsValid)
     {
         repo.CreateDisease(disease);
         return(RedirectToAction("Index"));
     }
     return(View(disease));
 }