/// <summary>
        /// Get country name by id.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetCountryName(int id)
        {
            using (var travelContext = new TravelContext())
            {
                var countryName = travelContext.Countries.SingleOrDefault(x => x.Id == id).CountryName;

                return(countryName);
            }
        }
예제 #2
0
        /// <summary>
        /// Get hotel rooms.
        /// </summary>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public List <HotelRoom> GetHotelRooms(int hotelId)
        {
            using (var travelContext = new TravelContext())
            {
                var hotelRooms = travelContext.HotelRooms.Where(x => x.HotelId == hotelId);

                return(hotelRooms.ToList());
            }
        }
        /// <summary>
        /// Get countries.
        /// </summary>
        /// <returns></returns>
        public List <Country> GetCountries()
        {
            using (var travelContext = new TravelContext())
            {
                var countries = travelContext.Countries;

                return(countries.ToList());
            }
        }
예제 #4
0
        /// <summary>
        /// Get hotels by country.
        /// </summary>
        /// <param name="contry"></param>
        /// <returns></returns>
        public List <Hotel> GetHotelsByCountry(int countryId)
        {
            using (var travelContext = new TravelContext())
            {
                var hotels = travelContext.Hotels.Where(x => x.CountryId == countryId);

                return(hotels.ToList());
            }
        }
예제 #5
0
        /// <summary>
        /// Get hotels room.
        /// </summary>
        /// <returns></returns>
        public List <HotelRoom> GetHotelRooms()
        {
            using (var travelContext = new TravelContext())
            {
                var hotelRooms = travelContext.HotelRooms;

                return(hotelRooms.ToList());
            }
        }
예제 #6
0
        /// <summary>
        /// Get hotels by category.
        /// </summary>
        /// <param name="hotelCategory"></param>
        /// <returns></returns>
        public List <Hotel> GetHotelsByCategory(int hotelCategory)
        {
            using (var travelContext = new TravelContext())
            {
                var hotels = travelContext.Hotels.Where(x => x.HotelCategoryId == hotelCategory);

                return(hotels.ToList());
            }
        }
예제 #7
0
        /// <summary>
        /// Get hotel.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Hotel GetHotel(int id)
        {
            using (var travelContext = new TravelContext())
            {
                var hotels = travelContext.Hotels.SingleOrDefault(x => x.Id == id);

                return(hotels);
            }
        }
예제 #8
0
        /// <summary>
        /// Get rooms.
        /// </summary>
        /// <returns></returns>
        public List <Room> GetRooms()
        {
            using (var travelContext = new TravelContext())
            {
                var rooms = travelContext.Rooms;

                return(rooms.ToList());
            }
        }
예제 #9
0
        public HotelCategory GetHotelCategory(int categoryId)
        {
            using (var travelContext = new TravelContext())
            {
                var hotelCategory = travelContext.HotelCategories.SingleOrDefault(x => x.Id == categoryId);

                return(hotelCategory);
            }
        }
예제 #10
0
        /// <summary>
        /// Get hotel categories.
        /// </summary>
        /// <returns></returns>
        public List <HotelCategory> GetHotelCategories()
        {
            using (var travelContext = new TravelContext())
            {
                var hotelCategories = travelContext.HotelCategories;

                return(hotelCategories.ToList());
            }
        }