public static void ChangeCustomerContactName(string customerId, string newName) { var dbContex = new NorthwindEntities(); using (dbContex) { var customer = dbContex.Customers .FirstOrDefault(c => c.CustomerID == customerId); if (customer == null) { return; } customer.ContactName = newName; dbContex.SaveChanges(); } }
public static void DeleteCustomer(string custumerId) { var dbContex = new NorthwindEntities(); using (dbContex) { var customer = dbContex.Customers .Where(c => c.CustomerID == custumerId) .FirstOrDefault(); if (customer == null) { return; } dbContex.Customers.Remove(customer); dbContex.SaveChanges(); } }
public static void DeleteCustomer(string custumerId) { var dbContex = new NorthwindEntities(); using (dbContex) { var customer = dbContex.Customers .Where(c => c.CustomerID == custumerId) .FirstOrDefault(); if (customer == null) { return; } dbContex.Customers.Remove(customer); dbContex.SaveChanges(); } }
public static void ChangeCustomerContactName(string customerId, string newName) { var dbContex = new NorthwindEntities(); using (dbContex) { var customer = dbContex.Customers .FirstOrDefault(c => c.CustomerID == customerId); if (customer == null) { return; } customer.ContactName = newName; dbContex.SaveChanges(); } }
public static void InsertCustomer(Customer custumer) { var dbContex = new NorthwindEntities(); using (dbContex) { dbContex.Customers.Add(custumer); dbContex.SaveChanges(); } }