Esempio n. 1
0
        protected override void ProcessRecord()
        {
            var assignments = new UserAssignmentsDto
            {
                UserIds        = UserIds.Select(u => (long?)u).ToList(),
                RolesPerFolder = new List <FolderRolesDto>
                {
                    new FolderRolesDto
                    {
                        FolderId = Folder?.Id ?? Id.Value,
                        RoleIds  = RoleIds.Select(r => (int?)r).ToList()
                    }
                }
            };

            HandleHttpOperationException(() => Api_19_10.Folders.AssignUsers(new AssignUsersActionParameters(assignments)));
        }
        public new void AsCsvRow(CsvWriter writer, bool bulk = true)
        {
            base.AsCsvRow(writer, bulk);

            writer.WriteField(EnabledUser);
            writer.WriteField(String.Join(',', UserOrgs.Select(uo => uo.OrgId)));
            writer.WriteField(Role);
            writer.WriteField(Username);
            writer.WriteField(UserIds == null ? "" : String.Join(',', UserIds.Select(ui => $"{{{ui.Type}:{ui.Identifier}}}")));
            writer.WriteField(GivenName);
            writer.WriteField(FamilyName);
            writer.WriteField(MiddleName);
            writer.WriteField(Identifier);
            writer.WriteField(Email);
            writer.WriteField(SMS);
            writer.WriteField(Phone);
            writer.WriteField(String.Join(',', UserAgents.Select(ua => ua.AgentUserId)));
            writer.WriteField(String.Join(',', Grades));
            writer.WriteField(Password);

            writer.NextRecord();
        }
        public IQueryable <ApplicationUser> Create(IQueryable <ApplicationUser> query)
        {
            if (UserId != null)
            {
                var strUserId = TempIdConverter.ConvertId(UserId.Value);//Dont need this temp string if you go all guid
                query = query.Where(i => i.Id == strUserId);
                return(query);
            }

            if (UserIds?.Count > 0)
            {
                var strUserIds = UserIds.Select(i => TempIdConverter.ConvertId(i)).ToList(); //Dont need this temp list if you go all guid
                query = query.Where(i => strUserIds.Contains(i.Id));
                return(query);
            }

            if (UserName != null)
            {
                query = query.Where(i => EF.Functions.Like(i.UserName, $"%{UserName}%"));
            }

            return(query);
        }