public void UpdateList() { List <CustomerClass> customers = _customerRepo.getList(); int index = customers.FindIndex(x => x.FirstName == firstName); CustomerClass edit = new CustomerClass("firstName", "lastName", "type", "email"); Console.WriteLine("What would you like to update name to"); Console.ReadLine(); string newName = Console.ReadLine(); customers[index].FirstName = newName; }
public void UpdateCustomer(string name, CustomerClass customer) { List <CustomerClass> updateCustomer = customers.FindAll(x => x.LastName == name); foreach (CustomerClass c in updateCustomer) { customers.Remove(c); } customers.Add(customer); // itierated through private customer list // if logic statement checking that the parameter == current cutstomer of the iteration loop // }
//Add Customer public void AddCustomerToList(CustomerClass customer) { customers.Add(customer); }