public async Task <List <Hotel> > GetAllHotels() { List <Hotel> AllHotels = new List <Hotel>(); AllHotels = await TempHotelRepository.GetAllHotels(); return(AllHotels); }
public List <Hotel> GetAllHotels() { List <Hotel> AllHotels = new List <Hotel>(TempHotelRepository.GetAllHotels()); return(AllHotels); }
private void GetHotels() { hotels = repoHotels.GetAllHotels(); }
public Query(HotelRepository hotelRepository) { Field <HotelType>("Hotel", arguments: new QueryArguments(new QueryArgument <NonNullGraphType <IdGraphType> > { Name = "id", Description = "The ID of the Hotel" }), resolve: context => { var id = context.GetArgument <int>("id"); return(hotelRepository.GetById(id)); }); Field <NonNullGraphType <ListGraphType <NonNullGraphType <HotelType> > > >("Hotels", resolve: context => hotelRepository.GetAllHotels()); }
private void ApplicationControl() { HotelRepository hotelRepository = new HotelRepository(); ConsoleView.DisplayWelcomeScreen(); using (hotelRepository) { List <Hotel> hotels = hotelRepository.GetAllHotels(); int hotelID; Hotel hotel; string message; while (active) { AppEnum.ManagerAction userActionChoice; userActionChoice = ConsoleView.GetUserActionChoice(); switch (userActionChoice) { case AppEnum.ManagerAction.None: break; case AppEnum.ManagerAction.ListAllHotels: ConsoleView.DisplayAllHotels(hotels); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.DisplayHotelDetail: hotelID = ConsoleView.GetHotelID(hotels); ConsoleView.DisplayHotelDetail(hotelRepository.GetHotelByID(hotelID)); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.DeleteHotel: hotelID = ConsoleView.GetHotelID(hotels); hotelRepository.DeleteHotel(hotelID); ConsoleView.DisplayReset(); message = String.Format("Hotel ID: {0} has been deleted from the list.", hotelID); ConsoleView.DisplayMessage(message); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.AddHotel: hotel = ConsoleView.AddHotel(); hotelRepository.AddHotel(hotel); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.UpdateHotel: hotelID = ConsoleView.GetHotelID(hotels); hotel = hotelRepository.GetHotelByID(hotelID); hotel = ConsoleView.UpdateHotels(hotel); hotelRepository.UpdateHotel(hotel); break; case AppEnum.ManagerAction.QueryHotelsByRoomsAvilable: List <Hotel> matchinghotels = new List <Hotel>(); int minimumRoomsAvailable; int maximumRoomsAvailable; ConsoleView.GetRoomsAvailableQueryMinMaxValues(out minimumRoomsAvailable, out maximumRoomsAvailable); matchinghotels = hotelRepository.QueryByRoomsAvailable(minimumRoomsAvailable, maximumRoomsAvailable); ConsoleView.DisplayQueryResults(matchinghotels); ConsoleView.DisplayContinuePrompt(); break; case AppEnum.ManagerAction.Quit: active = false; break; default: break; } } } ConsoleView.DisplayExitPrompt(); }