public void InsertOrUpdate(UserRole userrole) { if (userrole.UserRoleID == default(int)) { // New entity context.UserRole.Add(userrole); } else { // Existing entity context.Entry(userrole).State = EntityState.Modified; } }
public ActionResult Create(UserRole userrole) { if (ModelState.IsValid) { userroleRepository.InsertOrUpdate(userrole); userroleRepository.Save(); return RedirectToAction("Index"); } else { return View(userrole); } }
public ActionResult Create() { UserRole userrole = new UserRole(); return View(userrole); }
public ViewResult Search(UserRole searchUserRole) { if(searchUserRole!=null) { } return View("Index",userroleRepository.All); }