public AccountEditModel(ApplicationUser user, List <ApplicationRole> roles)
        {
            Id       = user.Id;
            UserName = user.UserName;
            RealName = user.RealName;
            StaffId  = user.StaffId;
            List <string> list = new List <string>();

            foreach (var role in user.Roles.ToList())  //把rolesID转换到tokenbox中
            {
                RoleIds.Add(role.RoleId);
                list.Add(roles.FirstOrDefault(r => r.Id == role.RoleId).Name);
            }
            //把roleId转换为roleName字符串
            Roles = string.Join(";", list.ToArray());
        }
Exemple #2
0
 public RoleFilter(int id)
 {
     RoleIds.Add(id);
 }
Exemple #3
0
 public RolePermissionFilter(int id)
 {
     RoleIds.Add(id);
 }