public int GetCustomerID(string orderId)
 {
     try
     {
         G2Entities db = new G2Entities();
         Customer customer = db.Customers.Find(orderId);
         return customer.ID;
     }
     catch (Exception e)
     {
         return -1;
     }
     
 }
        public string InsertCustomer(Customer customer)
        {
            try
            {
                G2Entities db = new G2Entities();
                db.Customers.Add(customer);
                db.SaveChanges();

                return "";
            }
            catch (Exception e)
            {
                return "Error:" + e; 
            }
        }
Beispiel #3
0
        //}


        private void RankAdd()
        {
            G2Entities db = new G2Entities();
            List<Cart> list = (List<Cart>)Session["cart"];
            ProductModel productModel = new ProductModel();

            if (Session["cart"] != null)
            {
                foreach (var c in list)
                {
                    var p = productModel.GetProduct(c.ProductID);
                    var b = db.Products.Find(c.ProductID);

                    p.Rank = b.Rank++;
                    db.SaveChanges();
                }
            }
        }