示例#1
0
        public ActionResult SetUserGroups(int id = 0)
        {
            ViewBag.KeyId = id;
            var user = _userService.GetUser(c => c.Id == id);

            if (user == null)
            {
                return(PartialView("Create", new UserVM()));
            }
            else
            {
                var ids  = _userGroupUsersSvc.ToListEx(c => c.User_Id == id, c => c.UserGroup_Id);
                var list = _userGroupService.ToListEx(c => c.Enabled == true, c => new CheckBoxVM()
                {
                    Name        = "chkUserGroups",
                    Value       = c.Id,
                    Discription = c.GroupName,
                    IsChecked   = ids.Contains(c.Id)
                });
                return(PartialView("_SetCheckBox", list));
            }
        }