protected void btnSave_Click(object sender, EventArgs e) { StarBusModel.BookingDetail objBooking = new StarBusModel.BookingDetail(); objBooking.TourID = tourID; objBooking.Name = txtName.Text; objBooking.Phone = txtPhone.Text; objBooking.Amount = Convert.ToDecimal(Request.Form[txtAmount.ClientID]); string[] seats = Request.Form[txtSeatNo.ClientID].Split(new char[] { ',' }); for (int i = 0; i < seats.Length; i++) objBooking.SeatDetails.Add(new StarBusModel.SeatDetail() { SeatID = Convert.ToInt32(seats[i]) }); objEntities.BookingDetails.AddObject(objBooking); objEntities.SaveChanges(); BindSeats(); }
/// <summary> /// Create a new BookingDetail object. /// </summary> /// <param name="bookingID">Initial value of the BookingID property.</param> public static BookingDetail CreateBookingDetail(global::System.Int32 bookingID) { BookingDetail bookingDetail = new BookingDetail(); bookingDetail.BookingID = bookingID; return bookingDetail; }
/// <summary> /// Deprecated Method for adding a new object to the BookingDetails EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToBookingDetails(BookingDetail bookingDetail) { base.AddObject("BookingDetails", bookingDetail); }