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