public bool InsertOrderPromotion(int PromotionID, int OrderID)
 {
     try
     {
         OrderPromotion orderPromotion = new OrderPromotion();
         orderPromotion.OrderID     = OrderID;
         orderPromotion.PromotionID = PromotionID;
         context.OrderPromotions.InsertOnSubmit(orderPromotion);
         context.SubmitChanges();
         return(true);
     }
     catch (Exception e)
     {
         throw new Exception("Error Insert " + e.Message);
     }
 }
Exemplo n.º 2
0
 private async Task <Order> RemovePromoAsync(string orderID, OrderPromotion promo)
 {
     try
     {
         return(await _oc.Orders.RemovePromotionAsync(OrderDirection.Incoming, orderID, promo.Code));
     }
     catch
     {
         // this can leave us in a bad state if the promotion can't be deleted but no longer valid
         throw new CatalystBaseException(new ApiError
         {
             ErrorCode = "Promotion.ErrorRemoving",
             Message   = $"Unable to remove promotion {promo.Code}",
             Data      = new
             {
                 Promotion = promo
             }
         });
     }
 }