public void SaveChanges() { InvoiceDetailbindingSource.EndEdit(); _invoice = (Invoice)InvoiceDetailbindingSource.DataSource; try { _context.SaveChanges(); } catch (Exception) { ViewHelper.ShowSaveError(); return; } }
public void DeleteObject() { if (_newMode) { return; } InvoiceDetailbindingSource.EndEdit(); var invoice = (Invoice)InvoiceDetailbindingSource.DataSource; try { //_context.Invoices.DeleteObject(invoice); _context.SaveChanges(); Close(); } catch (Exception e) { ViewHelper.ShowDeleteError(); ErrorLogger.LogError(this, e); } }