예제 #1
0
        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));
        }
예제 #2
0
 public IPagedList <Complaint> GetComplaintsByFacebookId(IPagingInformation pagingInformation, long facebookId)
 {
     return(base.PagedGetAll(pagingInformation, c => c.FacebookUserId == facebookId));
 }
예제 #3
0
 public IPagedList <Complaint> GetComplaintsByTag(IPagingInformation pagingInformation, Guid tagId)
 {
     return(base.PagedGetAll(pagingInformation, c => c.Tags.Any(t => t.Id == tagId)));
 }
예제 #4
0
        public static IPagedList <Complaint> GetPagedTestComplaints(IPagingInformation paging)
        {
            var c = GetTestComplaints();

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