public async Task <IActionResult> GetFlights([FromQuery] FlightParameters parameters) { var flights = await _flightRepository.GetFlights(parameters); if (flights == null || !flights.Any()) { return(BadRequest("Could not find any flights")); } Response.AddPaginationHeader(flights.CurrentPage, flights.PageSize, flights.TotalCount, flights.TotalPages); return(Ok(flights)); }
public async Task <PagedList <FlightForListDto> > GetFlights(FlightParameters parameters) { try { var flights = _context.Flights.Where(x => x.DateOfArrival > DateTime.UtcNow) .OrderBy(x => x.DateOfDeparture) .Include(x => x.Origin) .Include(x => x.Destination) .ProjectTo <FlightForListDto>(_mapper.ConfigurationProvider) .AsNoTracking(); return(await PagedList <FlightForListDto> .CreateAsync(flights, parameters.PageNumber, parameters.PageSize)); } catch (Exception e) { Console.WriteLine(e); return(null); } }
protected override float getCurrentValue() { return(FlightParameters.get().PID_P); }
protected override void increateValue(float pValue) { FlightParameters.get().PID_P += pValue; }
private string getPIDValues() { return(String.Format(@"P: {0}, I: {1}, D: {2}", FlightParameters.get().PID_P, FlightParameters.get().PID_I, FlightParameters.get().PID_D)); }