public ActionResult UserRole(string ID) { var userRole = SysService.GetUserRoles(ID); UserAuthModel model = new UserAuthModel { UserID = ID, Roles = new List <AuthRoleModel>() }; foreach (var r in SysService.GetRoles("", "")) { model.Roles.Add(new AuthRoleModel { RoleID = r.RoleID, Name = r.Name, IsSelected = userRole.FirstOrDefault(f => f.Equals(r.RoleID)) != null }); } return(View(model)); }