Exemplo n.º 1
0
        public bool Checkout()
        {
            if (ValidCart())
            {
                //add payments for each booking
                foreach(Booking b in GetBookings()){
                    Payment p = new Payment();
                    p.id = Guid.NewGuid();
                    p.amount = b.GetBookingTotal();
                    p.payment_date = DateTime.Now;
                    p.Booking = b;
                    ctx.AddToPayments(p);
                }

                ctx.SaveChanges();
                Empty();
                return true;
            }
            else
            {
                return false;
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Payments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPayments(Payment payment)
 {
     base.AddObject("Payments", payment);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Create a new Payment object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static Payment CreatePayment(global::System.Guid id)
 {
     Payment payment = new Payment();
     payment.id = id;
     return payment;
 }