public static void AddCoffee(Drink d) { using (CoffeeDatabaseEntities context = new CoffeeDatabaseEntities()) { context.Drink.Add(d); context.SaveChanges(); } }
public static void DeleteCustomer(Customer c) { var context = new CoffeeDatabaseEntities(); context.Entry(c).State = EntityState.Deleted; context.SaveChanges(); }
public static List <Drink> GetAllCoffee() { using (CoffeeDatabaseEntities context = new CoffeeDatabaseEntities()) { List <Drink> allCoffee = context.Drink.ToList(); return(allCoffee); } }
public static void Update(Drink d) { using (CoffeeDatabaseEntities context = new CoffeeDatabaseEntities()) { context.Entry(d).State = System.Data.Entity.EntityState.Detached; context.Drink.Add(d); context.Entry(d).State = System.Data.Entity.EntityState.Modified; context.SaveChanges(); } }
public static Customer Update(Customer c) { CoffeeDatabaseEntities context = new CoffeeDatabaseEntities(); context.Entry(c).State = EntityState.Modified; context.SaveChanges(); return(c); }
public static Customer AddCustomer(Customer c) { CoffeeDatabaseEntities context = new CoffeeDatabaseEntities(); context.Customer.Add(c); context.SaveChanges(); return(c); }
public static List <Customer> GetCustomers() { var context = new CoffeeDatabaseEntities(); //SELECT * FROM Customers List <Customer> allCustomers = (from c in context.Customer select c).ToList(); return(allCustomers); }