public IQueryable <User> GetUsers(string fullname) { IQueryable <User> query = _userRepository; if (!string.IsNullOrWhiteSpace(fullname)) { query = query.GetFinder() .All(UserSpecifications.FirstNameContains(fullname).Or(UserSpecifications.LastNameContains(fullname))) .AsQueryable(); } var users = query .OrderBy(x => x.FirstName + x.LastName).AsQueryable(); return(users); }
public IQueryable <User> GetUsers(out int total, int?offset = null, int?limit = null, bool?active = null, string fullname = null) { IQueryable <User> query = _userRepository; if (!string.IsNullOrWhiteSpace(fullname)) { query = query.GetFinder() .All(UserSpecifications.FirstNameContains(fullname).Or(UserSpecifications.LastNameContains(fullname))) .AsQueryable(); } if (active.HasValue) { query = query.Where(x => x.IsActive == active.Value); } total = query.Count(); var users = query.Paging(offset, limit) .OrderBy(x => x.FirstName + x.LastName).AsQueryable(); return(users); }