public ActionResult Create(Role role) { if (ModelState.IsValid) { roleRepository.InsertOrUpdate(role); roleRepository.Save(); return RedirectToAction("Index"); } else { return View(); } }
public void InsertOrUpdate(Role role) { // Roles are different as there is only one column (primary key). Therefore there is really only insert // without messing up all of the relationships. context.Roles.Add(role); }