public async Task <IActionResult> GetAll([FromQuery] PageFilter pageFilter, [FromQuery] RentalFilter filter) { var result = await _rentalService.GetAll(pageFilter, filter); if (result.Success) { return(Ok(result)); } return(BadRequest(result)); }
public ActionResult Index(RentalFilter filters) { List <Rental> rentals; if (filters != null && filters.PriceLimit.HasValue) { rentals = context.Rentals.Find(r => r.Price >= filters.PriceLimit).ToList(); } else { rentals = context.Rentals.Find(_ => true).ToList(); } var model = new RentalListViewModel() { Rentals = rentals.OrderBy(r => r.Price), Filters = filters }; return(View(model)); }
public async Task <IDataResult <List <Rental> > > GetAll(PageFilter pageFilter, RentalFilter filter = null) { return(new SuccessPagedDataResult <List <Rental> >( await _rentalDal.GetAllAsync(pageFilter, filter, r => r.Company, r => r.Customer, r => r.Car))); }