Пример #1
0
        public Boolean insertCartItems(List<string> itemIds, long OrderId)
        {
            try
            {
                foreach (string itemId in itemIds)
                {
                    //insert into Cart table
                    CartItem cart = new CartItem();
                    cart.ItemID = long.Parse(itemId);
                    cart.Quantity = 0;
                    cart.Price = 0;
                    cart.AppUserID = long.Parse(Session["AppUserID"].ToString());
                    cart.OrderID = OrderId;
                    cart.DateAdded = DateTime.Now;
                    //cart.IsOrdered = false;
                    cart.DateOrdered = Convert.ToDateTime("1 Jan 1900");

                    cart = new OrderService().InsertCart(cart);
                }

                return true;
            }
            catch (Exception exception)
            {
                return false;
            }
        }
Пример #2
0
 //Create
 public CartItem Insert(CartItem CartItem)
 {
     using (Entities ctx = new Entities())
     {
         try
         {
             ctx.CartItem.Add(CartItem);
             ctx.SaveChanges();
             return this;
         }
         catch (Exception exception)
         {
             return this;
         }
     }
 }
Пример #3
0
 public CartItem InsertCart(CartItem cart)
 {
     ICartItem cartObject = new CartItem();
     return cartObject.Insert(cart);
 }
Пример #4
0
 public List<CartItem> getCartItemsByOrderId(long orderId)
 {
     ICartItem cart = new CartItem();
     return cart.GetByOrderId(orderId);
 }