public static void UpdateAddress(Address addressObject) { using (AddressDB db = new AddressDB()) { db.Address.Update(addressObject); db.SaveChanges(); } }
public static void RemoveAddress(int id) { using (AddressDB db = new AddressDB()) { if (db.Address.Where(t => t.Id == id).Count() > 0) // Check if element exists db.Address.Remove(db.Address.First(t => t.Id == id)); db.SaveChanges(); } }