public virtual IPagedList <TEntityType> PagedGetAll(IPagingInformation pagingInformation, params Expression <Func <TEntityType, bool> >[] filters)
        {
            var items = _context.Set <TEntityType>().AsQueryable();

            if (filters != null && filters.Any())
            {
                filters.ForEach(f => items = items.Where(f));
            }

            var totalItemCount = items.Count();

            switch (pagingInformation.SortDirection)
            {
            case SortDirection.Asc:
                items = items.OrderBy(pagingInformation.SortBy);
                break;

            case SortDirection.Desc:
                items = items.OrderByDescending(pagingInformation.SortBy);
                break;
            }

            return(items.Skip(((pagingInformation.Page - 1) * pagingInformation.ResultsPerPage)).
                   Take(pagingInformation.ResultsPerPage).
                   ToPagedList(pagingInformation.Page - 1, pagingInformation.ResultsPerPage, totalItemCount));
        }
Esempio n. 2
0
 public IPagedList <Complaint> GetComplaintsByFacebookId(IPagingInformation pagingInformation, long facebookId)
 {
     return(base.PagedGetAll(pagingInformation, c => c.FacebookUserId == facebookId));
 }
Esempio n. 3
0
 public IPagedList <Complaint> GetComplaintsByTag(IPagingInformation pagingInformation, Guid tagId)
 {
     return(base.PagedGetAll(pagingInformation, c => c.Tags.Any(t => t.Id == tagId)));
 }
        public static IPagedList <Complaint> GetPagedTestComplaints(IPagingInformation paging)
        {
            var c = GetTestComplaints();

            return(new PagedList <Complaint>(c, paging.Page, paging.ResultsPerPage, c.Count()));
        }
 public static IPagedList<Complaint> GetPagedTestComplaints(IPagingInformation paging)
 {
     var c = GetTestComplaints();
     return new PagedList<Complaint>(c, paging.Page, paging.ResultsPerPage, c.Count());
 }