/// <summary>
 /// creates amenity
 /// </summary>
 /// <param name="amenities">passes in amenity object ready for user input</param>
 /// <returns>amenity added to database</returns>
 public async Task CreateAmenitie(Amenities amenities)
 {
     try
     {
         _context.Add(amenities);
         await _context.SaveChangesAsync();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemple #2
0
 public async Task CreateHotel(Hotel hotel)
 {
     try
     {
         _context.Add(hotel);
         await _context.SaveChangesAsync();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
Exemple #3
0
        public async Task <IActionResult> Create([Bind("AmenitiesID,RoomID")] RoomAmenities roomAmenities)
        {
            if (ModelState.IsValid)
            {
                _context.Add(roomAmenities);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AmenitiesID"] = new SelectList(_context.Amenities, "ID", "Name", roomAmenities.AmenitiesID);
            ViewData["RoomID"]      = new SelectList(_context.Room, "ID", "Name", roomAmenities.RoomID);
            return(View(roomAmenities));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("HotelID,RoomNumber,RoomID,Rate,PetFriendly")] HotelRoom hotelRoom)
        {
            if (ModelState.IsValid)
            {
                _context.Add(hotelRoom);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["HotelID"] = new SelectList(_context.Hotel, "ID", "Name", hotelRoom.HotelID);
            ViewData["RoomID"]  = new SelectList(_context.Room, "ID", "Name");
            return(View(hotelRoom));
        }
Exemple #5
0
 public async Task CreateRoom([Bind("ID,Name,RoomLayout")] Room hotel)
 {
     _context.Add(hotel);
     await _context.SaveChangesAsync();
 }