public static Contact CreateContact(string customer, Contact instance) { List<Contact> contacts = GetContacts(customer); // Set ID string ID = (contacts.Count + 1).ToString(); instance.ID = string.Format("{0}-c{1}", customer, ID); contacts.Add(instance); SaveContacts(customer, contacts); return instance; }
public Contact CreateContactJson(string customer, Contact instance) { return XmlDataStore.CreateContact(customer, instance); }
public Contact UpdateContact(string customer, Contact instance) { return XmlDataStore.UpdateContact(customer, instance); }
public static Contact UpdateContact(string customer, Contact instance) { List<Contact> contacts = GetContacts(customer); contacts.Remove(contacts.First(obj => obj.ID == instance.ID)); contacts.Add(instance); SaveContacts(customer, contacts); return instance; }