常用方法
常用方法
常用方法
常用方法
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)); }