public ActionResult Book( int hotelId, int roomId, string firstName, string lastName, string email, string cardNumber, string phone, DateTime arrival, DateTime departure) { var hotelRoom = this.hotelRooms .FreeHotelRoom(hotelId, roomId); var booking = new HotelSystem.Data.Models.Booking() { HotelRoomsId = hotelRoom.Id, BookedFrom = arrival, BookedTo = departure, FirstName = firstName, LastName = lastName, Email = email, CardNumber = cardNumber, Phone = phone }; this.bookings.CreateBooking(booking); var freeRoomsLeft = this.hotelRooms .GetAllFreeRoomsInHotel(hotelId, roomId) .Count(); this.TempData["Success"] = "Your booking finished successfully!"; return this.Json(new { Count = freeRoomsLeft, Id = roomId }); }
public ActionResult Book( int hotelId, int roomId, string firstName, string lastName, string email, string cardNumber, string phone, DateTime arrival, DateTime departure) { var hotelRoom = this.hotelRooms .FreeHotelRoom(hotelId, roomId); var booking = new HotelSystem.Data.Models.Booking() { HotelRoomsId = hotelRoom.Id, BookedFrom = arrival, BookedTo = departure, FirstName = firstName, LastName = lastName, Email = email, CardNumber = cardNumber, Phone = phone }; this.bookings.CreateBooking(booking); var freeRoomsLeft = this.hotelRooms .GetAllFreeRoomsInHotel(hotelId, roomId) .Count(); this.TempData["Success"] = "Your booking finished successfully!"; return(this.Json(new { Count = freeRoomsLeft, Id = roomId })); }