示例#1
0
        public static void InsertNewProduct(string name, int productType, int stock, int price)
        {
            Product newProduct = ProductFactory.CreateNewProduct(productType, name, stock, price);

            db.Products.Add(newProduct);
            db.SaveChanges();
        }
示例#2
0
        public static void InsertNewUser(string email, string name, string password, string gender)
        {
            User newUser = UserFactory.CreateNewUser(email, name, password, gender);

            db.Users.Add(newUser);
            db.SaveChanges();
        }
示例#3
0
        public static void DeletePayment(int id)
        {
            PaymentType types = db.PaymentTypes.Where(a => a.ID == id).FirstOrDefault();

            db.PaymentTypes.Remove(types);
            db.SaveChanges();
        }
示例#4
0
        public static void InsertNewProductType(string name, string desc)
        {
            ProductType newProduct = ProductTypeFactory.CreateNewProductType(name, desc);

            db.ProductTypes.Add(newProduct);
            db.SaveChanges();
        }
示例#5
0
        public static HeaderTransaction InsertNewHeaderTrans(int userId, int paymentId, DateTime date)
        {
            HeaderTransaction headerTrans = TransactionFactory.CreateNewHeaderTrans(userId, paymentId, date);

            db.HeaderTransactions.Add(headerTrans);
            db.SaveChanges();
            return(headerTrans);
        }
示例#6
0
        public static void InsertNewCart(int userId, int productId, int quantity)
        {
            Cart newCart = CartFactory.CreateNewCart(userId, productId, quantity);

            db.Carts.Add(newCart);
            db.SaveChanges();
        }