コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 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)));
 }