Ejemplo n.º 1
0
 /// <summary>
 /// Transcribes coupons associated with the basket into the new order
 /// </summary>
 /// <param name="basket">The basket checking out</param>
 /// <param name="order">The order being created</param>
 /// <remarks>This method does not modify the basket object</remarks>
 internal static void GenerateOrderCoupons(Basket basket, Order order)
 {
     foreach (BasketCoupon bc in basket.BasketCoupons)
     {
         //THIS MAKES SURE THE COUPON IS STILL VALID IN THE DATABASE?
         //TODO: CHECK BASKETCOUPON.DELETE METHOD FOR DB INTEGRITY RULES
         if (bc.Coupon != null)
         {
             OrderCoupon oc = new OrderCoupon();
             oc.OrderId    = order.OrderId;
             oc.CouponCode = bc.Coupon.CouponCode;
             oc.Save();
             order.Coupons.Add(oc);
         }
     }
 }
Ejemplo n.º 2
0
 public static SaveResult Insert(OrderCoupon orderCoupon)
 {
     return(orderCoupon.Save());
 }
Ejemplo n.º 3
0
 public static SaveResult Update(OrderCoupon orderCoupon)
 {
     return(orderCoupon.Save());
 }