Beispiel #1
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Update(int id)
        {
            ResourceMember      data     = new cncbk_resource_application.Controller.ResourceMemberController().GetModelById(id);
            List <ResourceRole> dataRole = new cncbk_resource_application.Controller.ResourceRoleController().GetByFilter(new FilterBaseModel());

            dataRole           = dataRole.Where(g => g.RoleType != 1).ToList();
            ViewBag.IsSupAdmin = GetAccount().IsSuperAdmin;
            if (data != null)
            {
                return(View(new ResAdminViewModel
                {
                    Id = data.Id,
                    Remark = data.Remark,
                    UserName = data.UserName,
                    Phone = data.Phone,
                    Email = data.Email,
                    RoleId = data.RoleId > 0 ? data.RoleId.ToString() : "",
                    State = data.State ? 0 : 1,
                    RoleList = (dataRole != null ? dataRole : null),
                    IsSupAdmin = data.ResRole.RoleType == 1
                }));
            }
            else
            {
                return(View());
            }
        }
Beispiel #2
0
        /// <summary>
        /// 更新
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Add()
        {
            List <ResourceRole> dataRole = new cncbk_resource_application.Controller.ResourceRoleController().GetByFilter(new FilterBaseModel());

            dataRole = dataRole.Where(g => g.RoleType != 1).ToList();
            return(View(new ResAdminViewModel()
            {
                RoleList = (dataRole != null ? dataRole : null)
            }));
        }
Beispiel #3
0
        public JsonResult CheckRoleName(string roleName, int id)
        {
            List <ResourceRole> resRoleList = new cncbk_resource_application.Controller.ResourceRoleController().GetByName(roleName);

            if (resRoleList != null && resRoleList.Count > 0)
            {
                if (resRoleList.Where(g => g.Id == id).Count() <= 0)
                {
                    return(Json("角色名称已存在", JsonRequestBehavior.AllowGet));
                }
            }

            return(Json(true, JsonRequestBehavior.AllowGet));
        }