public ActionResult Create(Disability disability) { if (ModelState.IsValid) { disabilityRepository.InsertOrUpdate(disability); disabilityRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(Disability disability) { if (disability.DisabilityID == default(int)) { // New entity context.Disability.Add(disability); } else { // Existing entity context.Entry(disability).State = EntityState.Modified; } }
public ViewResult Search(Disability searchDisability) { if(searchDisability!=null) { } return View("Index",disabilityRepository.All); }