public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PermissionRoles permission = db.PermissionRoles.Find(id); return(View(permission)); }
public ActionResult DeleteConfirmed(int id) { db.Configuration.ProxyCreationEnabled = false; string username = User.Identity.Name; PermissionRoles perm = db.PermissionRoles.Find(id); PermissionRoles perm1 = new PermissionRoles(); db.PermissionRoles.Remove(perm); db.SaveChanges(); auditTransact.CreateAuditTrail("Delete", id, "Role Permission", perm, perm1, username); TempData["message"] = "Role Permission successfully deleted!"; return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "PermissionRoleID,PermissionID,IsCreate,IsRead,IsUpdate,IsDelete,IsSubmit1,IsSubmit2,IsApprove,roleID,Desc,Status")] PermissionRoles permRole) { if (ModelState.IsValid) { string username = User.Identity.Name; db.PermissionRoles.Add(permRole); db.SaveChanges(); PermissionRoles pos = new PermissionRoles(); auditTransact.CreateAuditTrail("Create", permRole.permissionID, "Role Permission", pos, permRole, username); TempData["message"] = "Role Permission successfully created!"; return(RedirectToAction("Index")); } return(View(permRole)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PermissionRoles perm = db.PermissionRoles.Find(id); if (perm == null) { return(HttpNotFound()); } return(View(perm)); }
public ActionResult Edit([Bind(Include = "PermissionRoleID,permissionID,IsCreate,IsRead,IsUpdate,IsDelete,IsSubmit1,IsSubmit2,IsApprove,roleID")] PermissionRoles permissionRole) { if (ModelState.IsValid) { string username = User.Identity.Name; db.Configuration.ProxyCreationEnabled = false; PermissionRoles oldData = db.PermissionRoles.AsNoTracking().Where(p => p.PermissionRoleID.Equals(permissionRole.PermissionRoleID)).FirstOrDefault(); auditTransact.CreateAuditTrail("Update", permissionRole.PermissionRoleID, "Role Permission", oldData, permissionRole, username); db.Entry(permissionRole).State = EntityState.Modified; db.SaveChanges(); TempData["message"] = "Role Permission successfully updated!"; return(RedirectToAction("Index")); } return(View(permissionRole)); }