コード例 #1
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PermissionRoles permission = db.PermissionRoles.Find(id);

            return(View(permission));
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
 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));
 }
コード例 #4
0
        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));
        }
コード例 #5
0
 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));
 }