コード例 #1
0
ファイル: AjaxController.cs プロジェクト: shoopi/essexbooking
        public ActionResult AddHotelToCart(int hotel_id)
        {
            Cart cart = new Cart();
            Booking newbooking = new Booking
            {
                id = Guid.NewGuid(),
                Hotel = cart.ctx.Hotels.FirstOrDefault(h => h.id == hotel_id)
            };

            //init empty travel
            Travel travel = new Travel
            {
                id = Guid.NewGuid()
            };

            cart.ctx.AddToTravels(travel);
            newbooking.Travel = travel;

            newbooking.Travel.Passangers.Add(new Passanger { id = Guid.NewGuid() });//at least one passanger

            cart.ctx.Bookings.AddObject(newbooking);

            return PartialView("_CartPartial", cart);
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Travels EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToTravels(Travel travel)
 {
     base.AddObject("Travels", travel);
 }
コード例 #3
0
 /// <summary>
 /// Create a new Travel object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 /// <param name="travel_type_id">Initial value of the travel_type_id property.</param>
 /// <param name="departure">Initial value of the departure property.</param>
 /// <param name="arrival">Initial value of the arrival property.</param>
 public static Travel CreateTravel(global::System.Guid id, global::System.Int32 travel_type_id, global::System.DateTime departure, global::System.DateTime arrival)
 {
     Travel travel = new Travel();
     travel.id = id;
     travel.travel_type_id = travel_type_id;
     travel.departure = departure;
     travel.arrival = arrival;
     return travel;
 }
コード例 #4
0
ファイル: Cart.cs プロジェクト: shoopi/essexbooking
 public void Add(Travel travel)
 {
     ctx.Travels.AddObject(travel);
 }