示例#1
0
        public void updateProductInCard(int cardId, int productId)
        {
            DataClasses1DataContext db = new DataClasses1DataContext();
            ProductCard             productToDelete = (from p in db.ProductCards where cardId == p.CardId select p).Single();
            Product product = (from p in db.Products where productId == p.ProductId select p).Single();

            product.Quantity -= Convert.ToInt32(productToDelete.Quantity);
            // db.ProductCards.DeleteOnSubmit(productToDelete);
            db.SubmitChanges();
        }
示例#2
0
        //---------------------------Card functionality ------------------------------------------
        public void addProductToCard(int productId, int ProductTypeId, int userId, int quantity, decimal price)
        {
            DataClasses1DataContext db   = new DataClasses1DataContext();
            ProductCard             card = new ProductCard();

            card.ProductId     = productId;
            card.ProductTypeId = ProductTypeId;
            card.DateTime      = DateTime.Now;
            card.UserId        = userId;
            card.Quantity      = quantity;
            card.productPrice  = price;
            card.isRemoved     = "false";
            db.ProductCards.InsertOnSubmit(card);
            db.SubmitChanges();
        }
示例#3
0
 partial void UpdateProductCard(ProductCard instance);
示例#4
0
 partial void DeleteProductCard(ProductCard instance);
示例#5
0
 partial void InsertProductCard(ProductCard instance);