/// <summary> /// Create a new RoomReservation object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="startDate">Initial value of the StartDate property.</param> /// <param name="endDate">Initial value of the EndDate property.</param> /// <param name="noOfGuest">Initial value of the NoOfGuest property.</param> public static RoomReservation CreateRoomReservation(global::System.Int32 id, global::System.DateTime startDate, global::System.DateTime endDate, global::System.Int32 noOfGuest) { RoomReservation roomReservation = new RoomReservation(); roomReservation.Id = id; roomReservation.StartDate = startDate; roomReservation.EndDate = endDate; roomReservation.NoOfGuest = noOfGuest; return(roomReservation); }
public String makeReservation(String roomNo, String guestName, String passport, DateTime startDate, DateTime endDate, int numOfGuest, Payment payment) { RoomReservation reservtaion = RoomReservation.CreateRoomReservation(0, startDate, endDate, numOfGuest); using (HotelDBEntities hotelDBEntities = new HotelDBEntities()) { reservtaion.Room = hotelDBEntities.Rooms.FirstOrDefault(room => room.RoomNo == roomNo); var theGuest = hotelDBEntities.Guests.FirstOrDefault(guest => guest.Name == guestName && guest.PassportNo == passport); if (theGuest == null) { theGuest = Guest.CreateGuest(0, guestName, passport); } reservtaion.Guest = theGuest; reservtaion.Payment = payment; hotelDBEntities.RoomReservations.AddObject(reservtaion); hotelDBEntities.SaveChanges(); } return("success"); }
/// <summary> /// Deprecated Method for adding a new object to the RoomReservations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRoomReservations(RoomReservation roomReservation) { base.AddObject("RoomReservations", roomReservation); }
/// <summary> /// Create a new RoomReservation object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="startDate">Initial value of the StartDate property.</param> /// <param name="endDate">Initial value of the EndDate property.</param> /// <param name="noOfGuest">Initial value of the NoOfGuest property.</param> public static RoomReservation CreateRoomReservation(global::System.Int32 id, global::System.DateTime startDate, global::System.DateTime endDate, global::System.Int32 noOfGuest) { RoomReservation roomReservation = new RoomReservation(); roomReservation.Id = id; roomReservation.StartDate = startDate; roomReservation.EndDate = endDate; roomReservation.NoOfGuest = noOfGuest; return roomReservation; }
/// <summary> /// Deprecated Method for adding a new object to the RoomReservations EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToRoomReservations(RoomReservation roomReservation) { base.AddObject("RoomReservations", roomReservation); }