コード例 #1
0
        public ActionResult Edit(UserModel model)
        {
            if (ModelState.IsValid)
            {
                model.IsShowMessage = 0;
                model.Flag          = 2;
                model.CreatedBy     = AdminSessionData.AdminUserId;
                model.CreatedFromIp = Request.UserHostAddress;
                model.UserType      = 'S'; // for admin user

                AdminUserHelper objHelper = new AdminUserHelper();
                int             result    = objHelper.PerformActionOnUser(model);
                if (result == 0)
                {
                    TempData["CommonMessage"] = AppLogic.setMessage(0, "Record updated successfully!");
                    return(RedirectToAction("List", "User"));
                }
                else if (result == -5)
                {
                    TempData["CommonMessage"] = AppLogic.setMessage(1, "User name password are same");
                }
                else if (result == -4)
                {
                    TempData["CommonMessage"] = AppLogic.setMessage(1, "Email address already exists");
                }
                else if (result == -3)
                {
                    TempData["CommonMessage"] = AppLogic.setMessage(1, "User name already exists");
                }
                else
                {
                    TempData["CommonMessage"] = AppLogic.setMessage(-1, "Error, please try again");
                }


                return(RedirectToAction("List", "User"));
            }
            RoleModel objRoleModel = new RoleModel();

            objRoleModel.Flag   = 3;
            objRoleModel.Status = 1;
            RoleHelper objRoleHelper = new RoleHelper();

            model.ListRole   = objRoleHelper.GetRoleByStatus(objRoleModel);
            model.ListStatus = GetStatus();
            return(View(model));
        }
コード例 #2
0
        public ActionResult Delete(int?userId, UserModel model)
        {
            model.Flag   = 3;
            model.UserId = (int)userId;
            AdminUserHelper objHelper = new AdminUserHelper();
            int             result    = objHelper.PerformActionOnUser(model);

            if (result == 0)
            {
                TempData["CommonMessage"] = AppLogic.setMessage(0, "Record deleted successfully!");
            }
            else
            {
                TempData["CommonMessage"] = AppLogic.setMessage(-1, "Error, Please try again");
            }
            return(RedirectToAction("List", "User"));
        }
コード例 #3
0
        public ActionResult Activate(int?userId, UserModel model)
        {
            model.Flag   = 4;
            model.UserId = (int)userId;
            model.Status = 1;
            AdminUserHelper objHelper = new AdminUserHelper();
            int             result    = objHelper.PerformActionOnUser(model);

            if (result == 0)
            {
                TempData["CommonMessage"] = AppLogic.setMessage(0, "Record activated successfully!");
            }
            else
            {
                TempData["CommonMessage"] = AppLogic.setMessage(-1, "Error, please try again");
            }
            return(RedirectToAction("List", "User", new { @At = "InActiveUser" }));
        }