public void addNewContact(Contact contact) { if (contact == null) { return; } using (var db = new myMailContext()) { db.Contacts.Add(contact); db.SaveChanges(); } }
public void removeMessage(Message message) { if (message == null) { return; } using (var db = new myMailContext()) { db.Messages.Attach(message); db.Messages.Remove(message); db.SaveChanges(); } }
public void removeContact(Contact contact) { if (contact == null) { return; } using (var db = new myMailContext()) { db.Contacts.Attach(contact); db.Contacts.Remove(contact); db.SaveChanges(); } }