// PUT: api/Contacts/5 public void Put(int id, [FromBody] Contact contact) { ContactLayer entities = new ContactLayer(); var ent = entities.GetContacts.FirstOrDefault(m => m.ID == id); ent.firstName = contact.firstName; ent.lastName = contact.lastName; ent.gender = contact.gender; ent.phoneNumber = contact.phoneNumber; ent.emailAddress = contact.emailAddress; ent.city = contact.city; entities.EditContact(id, contact); }
// DELETE: api/Contacts/5 public void Delete(int id) { ContactLayer entities = new ContactLayer(); entities.DeleteContact(id); }
// GET: api/Contacts/5 public Contact Get(int id) { ContactLayer entities = new ContactLayer(); return(entities.GetContacts.FirstOrDefault(m => m.ID == id)); }
// POST: api/Contacts public void Post([FromBody] Contact contact) { ContactLayer entities = new ContactLayer(); entities.saveContact(contact); }
// GET: api/Contacts public IEnumerable <Contact> Get() { ContactLayer entities = new ContactLayer(); return(entities.GetContacts.ToList()); }
public IEnumerable <ContactClassLibrary.Contact> getContacts() { ContactLayer db = new ContactLayer(); return(db.GetContacts.ToList()); }
public ContactClassLibrary.Contact Details(int id) { ContactLayer db = new ContactLayer(); return(db.GetContacts.Single(x => x.ID == id)); }
public void delete(int id) { ContactLayer db = new ContactLayer(); db.DeleteContact(id); }
public void createContact(ContactClassLibrary.Contact contact) { ContactLayer db = new ContactLayer(); db.saveContact(contact); }