public async Task <IActionResult> Index() { AirlineIndexModel viewModel = new AirlineIndexModel { Airlines = new List <Airline>(), Notification = new AlertNotification() }; return(View(viewModel)); }
public async Task <IActionResult> Search(string airlineSearch) { List <Airline> airlinesFound = string.IsNullOrEmpty(airlineSearch) ? await _context.Airlines.ToListAsync() : await _context.Airlines.Where(al => al.Name.Contains(airlineSearch) || al.IATA.Contains(airlineSearch) || al.ICAO.Contains(airlineSearch)).ToListAsync(); AirlineIndexModel viewModel = new AirlineIndexModel { Airlines = airlinesFound, Notification = new AlertNotification() }; return(View("Index", viewModel)); }