Exemplo n.º 1
0
        public ActionResult PermissionEditDB(PermissionViewModel pvm)
        {
            try
            {
                Permission permission = _repo.GetPermissionByID(pvm.PermissionID);

                string loggedinUserName = FreezeDown_ExtendedMethods.GetUID();
                int    loggedinUID      = new FreezeDownUser(loggedinUserName).UserID;

                bool rslt = false;

                if (permission != null)
                {
                    permission.PermissionName        = pvm.PermissionName;
                    permission.PermissionDescription = pvm.PermissionDescription;
                    permission.LastUpdate            = DateTime.Now.ConvertToEST();
                    permission.LastUpdateBy          = loggedinUID;
                }

                rslt = _repo.UpdatePermission(permission);

                TempData["IsSaved"] = true;


                return(RedirectToAction("PermissionEdit", "Admin2", new { PermissionID = permission.PermissionID }));
            }
            catch (Exception ex)
            {
                TempData["FreezeDownError"] = ex;
                return(RedirectToAction("ShowError", "Error"));
            }
        }
Exemplo n.º 2
0
        public ActionResult RoleEditDB(RoleViewModel rvm)
        {
            try
            {
                Role role = _repo.GetRoleByID(rvm.RoleID);

                string loggedinUserName = FreezeDown_ExtendedMethods.GetUID();
                int    loggedinUID      = new FreezeDownUser(loggedinUserName).UserID;

                bool rslt = false;

                if (role != null)
                {
                    role.RoleName        = rvm.RoleName;
                    role.RoleDescription = rvm.RoleDescription;
                    role.IsSysAdmin      = rvm.IsSysAdmin;
                    role.LastUpdate      = DateTime.Now.ConvertToEST();
                    role.LastUpdateBy    = loggedinUID;
                }

                rslt = _repo.UpdateRole(role);

                TempData["IsSaved"] = true;


                return(RedirectToAction("RoleEdit", "Admin2", new { RoleID = role.RoleID }));
            }
            catch (Exception ex)
            {
                TempData["FreezeDownError"] = ex;
                return(RedirectToAction("ShowError", "Error"));
            }
        }
Exemplo n.º 3
0
        public ActionResult UserEditDB(UserViewModel uvm)
        {
            try
            {
                User currentUser = _repo.GetUserByID(uvm.UserID);

                string loggedinUserName = FreezeDown_ExtendedMethods.GetUID();
                int    loggedinUID      = new FreezeDownUser(loggedinUserName).UserID;

                bool rslt = false;

                if (currentUser != null)
                {
                    currentUser.UserName     = uvm.UserName;
                    currentUser.Password     = uvm.Password;
                    currentUser.LastName     = uvm.LastName;
                    currentUser.FirstName    = uvm.FirstName;
                    currentUser.EMail        = uvm.EMail;
                    currentUser.Inactive     = !uvm.Active;
                    currentUser.LastUpdate   = DateTime.Now.ConvertToEST();
                    currentUser.LastUpdateBy = loggedinUID;
                }

                rslt = _repo.UpdateUser(currentUser);

                TempData["IsSaved"] = true;


                return(RedirectToAction("UserEdit", "Admin2", new { UserID = currentUser.UserID }));
            }
            catch (Exception ex)
            {
                TempData["FreezeDownError"] = ex;
                return(RedirectToAction("ShowError", "Error"));
            }
        }