static void UpdateCustomer(string ID) { //var randomRabbitName = Console.ReadLine(); using (var db = new CustomerDbContext()) { var updateCustomer = db.Customers.Find(ID); updateCustomer.Country += "Bolivia"; db.Customers.Update(updateCustomer); db.SaveChanges(); } }
static void PrintCustomers() { using (var db = new CustomerDbContext()) { customers = db.Customers.ToList(); } foreach (var customer in customers) { Console.WriteLine($"{customer.CustomerID,-10}{customer.ContactName,-40}{customer.CompanyName,-40}{customer.City, -15}{customer.Country}"); } }
static void AddCustomer() { Random rand = new Random(); var newCustomer = new Customer() { CustomerID = "RABSG", ContactName = "Ross Brown", CompanyName = "Sparta Global", City = "Hemel Hempstead", Country = "UK" }; using (var db = new CustomerDbContext()) { db.Customers.Add(newCustomer); db.SaveChanges(); } }