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(); }
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(); }
public static void DeletePayment(int id) { PaymentType types = db.PaymentTypes.Where(a => a.ID == id).FirstOrDefault(); db.PaymentTypes.Remove(types); db.SaveChanges(); }
public static void InsertNewProductType(string name, string desc) { ProductType newProduct = ProductTypeFactory.CreateNewProductType(name, desc); db.ProductTypes.Add(newProduct); db.SaveChanges(); }
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); }
public static void InsertNewCart(int userId, int productId, int quantity) { Cart newCart = CartFactory.CreateNewCart(userId, productId, quantity); db.Carts.Add(newCart); db.SaveChanges(); }