/// <summary> /// Gets paged list of all VehicleModels. /// </summary> /// <param name="makeId"></param> /// <param name="filter"></param> /// <param name="paging"></param> /// <param name="sorting"></param> /// <returns> Paged list of all VehicleModels. </returns> public IPagedList<IVehicleModel> GetModels(Guid makeId, IFiltering filter, IPaging paging, ISorting sorting) { // Gets the search input. var searchString = filter.SearchString; // Gets the number and size of a page. int pageNumber = paging.PageNumber; int pageSize = paging.PageSize; // Gets the specific models of the make, conditioned by search string. var vehicleModels = genericRepository.GetSet<VehicleModel>().Where(m => m.MakeId == makeId); if (!String.IsNullOrEmpty(searchString)) { vehicleModels = vehicleModels.Where(m => m.Name == searchString || m.Abrev == searchString); } // Sorts the filtered list of models. var sortedModel = vehicleModels.OrderBy(sorting.Sorters.FirstOrDefault().GetSortExpression()); // Gets the paged list by parameters and maps it to corresponding type. var pagedList = genericRepository.GetPagedList(sortedModel, pageSize, pageNumber); IEnumerable<VehicleModelPoco> sourceList = Mapper.Map<IEnumerable<VehicleModel>, IEnumerable<VehicleModelPoco>>(pagedList); return new StaticPagedList<VehicleModelPoco>(sourceList, pagedList.GetMetaData()); }
public async Task <IEnumerable <UserIdentityDTO> > GetAllAsync(ISorting sorting, IFiltering filtering, IPaging paging) { var models = await userIdentityRepository.GetAllAsync(sorting, filtering, paging); return(models); }
public HomeController(DetectFace detectFace, IFiltering fiters, IPictureRepository repository) { _detectFace = detectFace; _filters = fiters; _repository = repository; }
public Parsing(ITransponderReceiver receiver, IFiltering filtering) //subscring { receiver.TransponderDataReady += Data; _filtering = filtering; _trackList = new List <TrackData>(); }
public async Task <IEnumerable <SeminarDTO> > GetAllAsync(ISorting sorting, IFiltering filtering, IPaging paging) { var models = await seminarRepository.GetAllAsync(sorting, filtering, paging); return(models); }
public async Task <IEnumerable <RegistrationDTO> > GetAllAsync(ISorting sorting, IFiltering filtering, IPaging paging) { var models = await registrationRepository.GetAllAsync(sorting, filtering, paging); return(models); }
public Task <IEnumerable <T> > GetAllAsync(IFiltering <T> filter) { throw new NotImplementedException(); }
public async Task <IEnumerable <Project> > GetAllAsync(Guid userId, IPaging paging, IFiltering filtering /*, ISorting sortObj*/) { bool pagingEnabled = paging.PageSize > 0; IQueryable <Project> query = context.Project.Include(up => up.UserProject).ThenInclude(u => u.User); if (pagingEnabled) { paging.TotalPages = (int)Math.Ceiling((decimal)query.Count() / (decimal)paging.PageSize); } else { paging.TotalPages = 1; } if (filtering.FilterValue != null) { query = query.Where(p => p.Name == filtering.FilterValue); } if (pagingEnabled) { return(await query.Skip((paging.PageNumber - 1) *paging.PageSize).Take(paging.PageSize).ToListAsync()); } else { return(await query.AsNoTracking().ToListAsync()); } }
public FilteringBinder(IFiltering filtering) { _filtering = filtering ?? throw new ArgumentNullException(nameof(filtering)); }
/// <summary> /// Gets paged list of all VehicleModels. /// </summary> /// <param name="makeId"></param> /// <param name="filter"></param> /// <param name="paging"></param> /// <param name="sorting"></param> /// <returns> Paged list of all VehicleModels. </returns> public IPagedList<IVehicleModel> GetModels(Guid makeId, IFiltering filter, IPaging paging, ISorting sorting) { return vehicleModelRepository.GetModels(makeId, filter, paging, sorting); }
public IPagedList <IRental> GetAll(ISorting sorting, IFiltering filtering, IPaging paging, IOptions options) { IQueryable <IRental> rentals = _unitOfWork.GetAll <Rental>(); if (options.IncludeBooks) { rentals = rentals.Include(r => r.Book); } if (options.IncludeCustomers) { rentals = rentals.Include(r => r.Customer); } // filter records based on the DateReturned beeing null or not switch (filtering.RecordsFilter) { case "Rented": rentals = rentals.Where(r => r.DateReturned == null); break; case "Returned": rentals = rentals.Where(r => r.DateReturned != null); break; } if (!string.IsNullOrEmpty(filtering.SearchString)) { switch (filtering.SearchBy) { case "Book Title": rentals = rentals.Where(r => r.Book.Title.ToLower().Contains(filtering.SearchString.ToLower())); break; case "Customer Name": rentals = rentals.Where(r => r.Customer.LastName.ToLower().Contains(filtering.SearchString.ToLower()) || r.Customer.FirstName.ToLower().Contains(filtering.SearchString.ToLower())); break; case "Rental Id": rentals = rentals.Where(r => r.Id.ToString().Contains(filtering.SearchString)); break; } } switch (sorting.SortingParam) { case "dRented": rentals = rentals.OrderBy(c => c.DateRented); break; case "dReturned": rentals = rentals.OrderBy(c => c.DateRented); break; case "dReturned_desc": rentals = rentals.OrderByDescending(c => c.DateRented); break; case "bookTitle": rentals = rentals.OrderBy(c => c.Book.Title); break; case "bookTitle_desc": rentals = rentals.OrderByDescending(c => c.Book.Title); break; case "customerName": rentals = rentals.OrderBy(c => c.Customer.LastName); break; case "customerName_desc": rentals = rentals.OrderByDescending(c => c.Customer.LastName); break; default: rentals = rentals.OrderByDescending(c => c.DateRented); break; } var pagedList = rentals.ToPagedList(paging.PageNumber, paging.PageSize); if (pagedList.PageCount < pagedList.PageNumber) { return(rentals.ToPagedList(1, paging.PageSize)); } return(pagedList); }
public IPagedList <ICustomer> GetAll(out IEnumerable <IRental> rentals, ISorting sorting, IFiltering filtering, IPaging paging, IOptions options) { IQueryable <ICustomer> customers = _unitOfWork.GetAll <Customer>(); if (!String.IsNullOrEmpty(filtering.SearchString)) { customers = customers.Where(c => c.FirstName.ToLower().Contains(filtering.SearchString.ToLower()) || c.LastName.ToLower().Contains(filtering.SearchString.ToLower())); } rentals = _unitOfWork.GetAll <Rental>() .Include(r => r.Book) .Where(r => r.CustomerId == options.Id) .OrderByDescending(x => x.DateRented); if ((options.IncludeRentalHistory == false) && (rentals != null)) { rentals = rentals.Where(r => r.DateReturned == null); } switch (sorting.SortingParam) { case "lName_desc": customers = customers.OrderByDescending(c => c.LastName); break; case "fName": customers = customers.OrderBy(c => c.FirstName); break; case "fName_desc": customers = customers.OrderByDescending(c => c.FirstName); break; case "accountNo": customers = customers.OrderBy(c => c.AccountNumber); break; case "accountNo_desc": customers = customers.OrderByDescending(c => c.AccountNumber); break; default: customers = customers.OrderBy(c => c.LastName); break; } var pagedList = customers.ToPagedList(paging.PageNumber, paging.PageSize); if (pagedList.PageCount < pagedList.PageNumber) { return(customers.ToPagedList(1, paging.PageSize)); } return(pagedList); }
public ControllerFactory(IPaging paging, ISorting sorting, IFiltering filtering) { _paging = paging; _sorting = sorting; _filtering = filtering; }
/// <summary> /// Gets paged list of all VehicleMakes. /// </summary> /// <param name="filter"></param> /// <param name="paging"></param> /// <param name="sorting"></param> /// <returns> A paged list of makes. </returns> public IPagedList<IVehicleMake> GetMakes(IFiltering filter, IPaging paging, ISorting sorting) { return vehicleMakeRepository.GetMakes(filter, paging, sorting); }