public ActionResult Delete(int id, AdminRole role) { try { DataContext.Delete(role); SaveChanges(); ShowSuccess(MessageResource.DeleteSuccess); return RedirectToIndex(); } catch { ShowError(MessageResource.DeleteFailed); } return RedirectToIndex(); }
public ActionResult Create(AdminRole model, FormCollection form) { if (ModelState.IsValid) { try { model.UpdatePermissions(GetPermissions(form)); DataContext.AdminRoles.Add(model); SaveChanges(); ShowSuccess(MessageResource.CreateSuccess); return RedirectToIndex(); } catch { ShowError(MessageResource.CreateFailed); } } return View(model); }