public async Task <IActionResult> Index()
        {
            SightingSearchByAirlineViewModel model = new SightingSearchByAirlineViewModel
            {
                PageNumber = 1
            };
            List <Airline> airlines = await _airlines.GetAirlinesAsync();

            model.SetAirlines(airlines);
            return(View(model));
        }
        public async Task <IActionResult> Index(SightingSearchByAirlineViewModel model)
        {
            if (ModelState.IsValid)
            {
                int page = model.PageNumber;
                switch (model.Action)
                {
                case ControllerActions.ActionPreviousPage:
                    page -= 1;
                    break;

                case ControllerActions.ActionNextPage:
                    page += 1;
                    break;

                case ControllerActions.ActionSearch:
                    page = 1;
                    break;

                default:
                    break;
                }

                // Need to clear model state here or the page number that was posted
                // is returned and page navigation doesn't work correctly. So, capture
                // and amend the page number, above, then apply it, below
                ModelState.Clear();

                List <Sighting> sightings = await _client.GetSightingsByAirline(model.AirlineId, page, _settings.Value.SearchPageSize);

                model.SetSightings(sightings, page, _settings.Value.SearchPageSize);

                List <Airline> airlines = await _airlines.GetAirlinesAsync();

                model.SetAirlines(airlines);
            }

            return(View(model));
        }