Пример #1
0
        public IQueryable <UserInfo> GetUsers(int tenant, out int total)
        {
            var userDbContext = UserDbContextManager.GetNew(DbId);

            total = userDbContext.Users.Where(r => r.Tenant == tenant).Count();
            return(userDbContext.Users.Where(r => r.Tenant == tenant).Select(FromUserToUserInfo));
        }
Пример #2
0
        public IQueryable <UserInfo> GetUsers(int tenant, bool isAdmin, EmployeeStatus?employeeStatus, List <List <Guid> > includeGroups, List <Guid> excludeGroups, EmployeeActivationStatus?activationStatus, string text, string sortBy, bool sortOrderAsc, long limit, long offset, out int total, out int count)
        {
            var userDbContext = UserDbContextManager.GetNew(DbId);
            var totalQuery    = userDbContext.Users.Where(r => r.Tenant == tenant);

            totalQuery = GetUserQueryForFilter(totalQuery, isAdmin, employeeStatus, includeGroups, excludeGroups, activationStatus, text);
            total      = totalQuery.Count();

            var q = GetUserQuery(userDbContext, tenant, default);

            q = GetUserQueryForFilter(q, isAdmin, employeeStatus, includeGroups, excludeGroups, activationStatus, text);

            if (!string.IsNullOrEmpty(sortBy))
            {
                q = q.OrderBy(sortBy, sortOrderAsc);
            }

            if (offset != 0)
            {
                q = q.Skip((int)offset);
            }

            if (limit != 0)
            {
                q = q.Take((int)limit);
            }

            count = q.Count();

            return(q.Select(FromUserToUserInfo));
        }