public bool Delete(List <int> ids) { //try //{ using (FinanceEntities context = factory.CreateContext()) { //context.Cashflows.Delete(e=>ids.Contains(e.CashflowId)); foreach (var id in ids) { var ef = new Cashflow() { CashflowId = id }; context.Entry(ef).State = EntityState.Deleted; } // deletes are cascaded to CashflowBankAccount context.SaveChanges(); } //} //catch (DbEntityValidationException e) //{ // CommonRepository.HandleDbEntityValidationException(e); //} return(true); }
public bool Delete(List<int> ids) { //try //{ using (FinanceEntities context = factory.CreateContext()) { //context.Cashflows.Delete(e=>ids.Contains(e.CashflowId)); foreach (var id in ids) { var ef = new Cashflow() { CashflowId = id }; context.Entry(ef).State = EntityState.Deleted; } // deletes are cascaded to CashflowBankAccount context.SaveChanges(); } //} //catch (DbEntityValidationException e) //{ // CommonRepository.HandleDbEntityValidationException(e); //} return true; }