public FeatureSetAccessModel(FeatureSetAccessList entity)
        {
            FeatureSetId     = entity.FeatureSetId;
            SelectedUserList = entity.SelectedUser.Select(x => new SelectListItem {
                Text = x.Value, Value = x.Key.ToString()
            }).ToList();;
            AvailableUserList = entity.AvailableUser.Select(x => new SelectListItem {
                Text = x.Value, Value = x.Key.ToString()
            }).ToList();

            SelectedUsers  = SelectedUserList.Select(x => x.Value).ToArray();
            AvailableUsers = AvailableUserList.Select(x => x.Value).ToArray();
        }
示例#2
0
        public FeatureSetAccessList UserFeatureSet(long featureSetId, long companyId)
        {
            FeatureSetAccessList entity = new FeatureSetAccessList();

            entity.FeatureSetId = featureSetId;
            entity.SelectedUser = (from a in this.Context.FeatureSetAccesses
                                   join b in this.Context.Users on a.UserId equals b.UserId
                                   where a.FeatureSetId == featureSetId && a.CompanyId == companyId
                                   select new
            {
                b.UserId,
                b.Username
            }
                                   ).ToDictionary(x => x.UserId, x => x.Username);
            return(entity);
        }