Beispiel #1
0
        public ActionResult Update(AdminUserWebMUpdate model)
        {
            AdminUserDb dbModel = AdminUserBll.Instance.GetModel(model.user_name);

            if (ModelState.IsValid && model != null)
            {
                dbModel.user_status    = model.user_status;
                dbModel.user_full_name = model.user_full_name;
                dbModel.modifi_name    = LoginUser.user_name;
                dbModel.modifi_date    = DateTime.Now;
                AdminUserBll.Instance.Update(dbModel, model.role_ids);
                return(Content("<script>alert('修改用户成功!');parent.layer.closeAll('iframe');</script>"));
            }
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Update(string userName = "")
        {
            if (string.IsNullOrEmpty(userName))
            {
                return(Redirect("list"));
            }
            AdminUserWebMUpdate webModel = new AdminUserWebMUpdate();
            AdminUserDb         dbModel  = AdminUserBll.Instance.GetModel(userName);

            if (dbModel != null)
            {
                ModelCopier.CopyModel(dbModel, webModel);
                if (dbModel.AdminUserRoleRelations != null && dbModel.AdminUserRoleRelations.Count > 0)
                {
                    webModel.role_ids   = string.Join(",", dbModel.AdminUserRoleRelations.Select(c => c.role_id).ToArray());
                    webModel.role_names = string.Join(",", dbModel.AdminUserRoleRelations.Select(c => c.RoleDb.role_name).ToArray());
                }
            }
            return(View(webModel));
        }