public static void DeleteCustomer(Customer input) { using (var db = new NorthwindEntities()) { db.Customers.Remove(input); db.SaveChanges(); } }
public static Customer GetCustomerById(string id) { using (var db = new NorthwindEntities()) { var result = db.Customers.FirstOrDefault(x => x.CustomerID == id); return result; } }
public static void AddCustomer(Customer input) { using (var db = new NorthwindEntities()) { db.Customers.Add(input); db.SaveChanges(); } }
public static void ModifyCustomer(Customer input) { using (var db = new NorthwindEntities()) { db.Customers.Attach(input); db.Entry(input).State = EntityState.Modified; db.SaveChanges(); } }