Example #1
0
        /// <summary>
        /// Adds member to the database
        /// </summary>
        /// <param name="m"></param>
        public static void RegisterMember(Member m)
        {
            ECommerceDB db = new ECommerceDB();

            db.Members.Add(m);
            db.SaveChanges(); //MUST call SaveChanges for INSERTS, UPDATES, and DELETES!
        }
Example #2
0
        public static void UpdateProduct(Product p)
        {
            ECommerceDB db = new ECommerceDB();

            db.Entry(p).State = EntityState.Modified;
            db.SaveChanges();
        }
Example #3
0
        /// <summary>
        /// Adds product to database
        /// </summary>
        /// <param name="p"></param>
        public static void AddProduct(Product p)
        {
            var db = new ECommerceDB();

            db.Products.Add(p);
            db.SaveChanges();
        }
Example #4
0
        public static void DeleteProductById(int value)
        {
            ECommerceDB db = new ECommerceDB();
            Product     p  = db.Products.Find(value);

            db.Products.Remove(p);
            db.SaveChanges();
        }