//Get plan paged list public static PageData <PlanDTO> GetPlanPagedList(PagingInfo pagingInfo) { List <PlanDTO> PlanDTOList = new List <PlanDTO>(); PageData <PlanDTO> pageList = new PageData <PlanDTO>(); if (pagingInfo == null) { PagingInfo PagingInfoCreated = new PagingInfo(); PagingInfoCreated.Page = 1; PagingInfoCreated.Reverse = false; PagingInfoCreated.ItemsPerPage = 1; PagingInfoCreated.Search = ""; PagingInfoCreated.TotalItem = 0; pagingInfo = PagingInfoCreated; } if (pagingInfo.SortBy == "") { pagingInfo.SortBy = "Title"; } PlanDTOList = GetPlanList(pagingInfo); IQueryable <PlanDTO> PlanDTOPagedList = PlanDTOList.AsQueryable(); UnitOfWork uow = new UnitOfWork(); int count = 0; if (pagingInfo.Search != "" && pagingInfo.Search != null) { bool IsDate = CommonService.IsDate(pagingInfo.Search); if (IsDate != true) { count = 0; count = uow.PlanRepo.GetAll().Where(e => (e.Title != null ? (e.Title.ToLower().Contains(pagingInfo.Search.ToLower())) : false) || e.Price.ToString().ToLower().Contains(pagingInfo.Search.ToLower()) || (e.Min.ToString() != null ? (e.Min.ToString().Contains(pagingInfo.Search.ToString())) : false) || e.Max.ToString().Contains(pagingInfo.Search) || (e.Tax.ToString() != null ? (e.Tax.ToString().ToLower().Contains(pagingInfo.Search.ToLower())) : false)).Count();//|| e.IsEcoupon.ToString().Contains(pagingInfo.Search) //.OrderBy(e => e.Company); } else { //DateTime date = Convert.ToDateTime(pagingInfo.Search); //count = 0; //count = uow.ClientRepo.GetAll().Where(e => e.RegisteredDate >= date && e.RegisteredDate < date.AddDays(1) && e.IsActive == IsActive && e.PartnerId == PartnerId).Count(); } } else { count = uow.PlanRepo.GetAll().Count(); } ////Sorting PlanDTOPagedList = PagingService.Sorting <PlanDTO>(PlanDTOPagedList, pagingInfo.SortBy, pagingInfo.Reverse); // paging if (PlanDTOPagedList.Count() > 0) { //var ContacDTOPerPage = PagingService.Paging<ClientDTO>(ClientDTOPagedList, pagingInfo.ItemsPerPage, pagingInfo.Page); pageList.Count = count;// ClientDTOPagedList.Count(); List <PlanDTO> pagedPlanDTOList = new List <PlanDTO>(); foreach (var item in PlanDTOPagedList) { pagedPlanDTOList.Add(item); } pageList.Data = pagedPlanDTOList; } else { pageList.Data = null; } return(pageList); }