public static Customer ReadItem(Int32 id) { // take a copy for SharePoint Customer c = new Customer(); Customer e = d[id]; c.CustomerId = e.CustomerId; c.FirstName = e.FirstName; c.LastName = e.LastName; c.Message = e.Message; return c; }
public static IEnumerable<Customer> ReadList() { // this is usually the first method called so check for null if (d == null) { d = new Dictionary<Int32, Customer>(); for (int i = 0; i < 10; i++) { Customer e = new Customer(); e.CustomerId = i; e.Message = i + " Item Data"; e.FirstName = i + " First Name"; e.LastName = i + " Last Name"; d.Add(i, e); } } return d.Values; }
public static void Update(Customer customer, Int32 id) { d[id].FirstName = customer.FirstName; d[id].LastName = customer.LastName; d[id].Message = customer.Message; }