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