Ejemplo n.º 1
0
        public async Task <IList <FlightDto> > GetFlightsByDateAsync(int accountId, DateTime startDate, DateTime endDate)
        {
            var spec   = new GetFlightsByAccountAndDateRange(accountId, startDate.Date, endDate.Date.AddDays(1).AddSeconds(-1));
            var result = await _flightRepository.GetBySpecAsync(spec);

            return(_mapper.Map <IList <Flight>, IList <FlightDto> >(result));
        }
Ejemplo n.º 2
0
        public async Task <IList <FlightDto> > GetRecentFlightsAsync(int accountId)
        {
            // Defining recent flights as all of those within the last month, based on the date of the request
            var dateFrom = DateTime.Now.Date.AddMonths(-1);
            // TODO update this to get flights SINCE a date. Will need a new spec. Hacked to get around timezones on server (as not passed from client)
            var spec   = new GetFlightsByAccountAndDateRange(accountId, dateFrom, DateTime.Now.Date.AddDays(2).AddSeconds(-1));
            var result = await _flightRepository.GetBySpecAsync(spec);

            return(_mapper.Map <IList <Flight>, IList <FlightDto> >(result));
        }