public bool RemoveLoanSchedule(int loanID) { try { using (LoanPriceEntities context = new LoanPriceEntities()) { List<LoanSchedule> loans = context.LoanSchedules.Where(s => s.LoanID == loanID).ToList(); for (int i = 0; i < loans.Count; i++) { context.DeleteObject(loans[i]); } context.SaveChanges(); return true; } } catch (Exception ex) { return false; } }
public bool RemoveAllLoans() { try { using (LoanPriceEntities context = new LoanPriceEntities()) { List<Loans> loans = context.Loans.ToList(); for (int i = 0; i < loans.Count; i++) { LoanScheduleBL loanScheduleBL = new LoanScheduleBL(); loanScheduleBL.RemoveLoanSchedule(loans[i].ID); context.DeleteObject(loans[i]); } context.SaveChanges(); return true; } } catch (Exception ex) { return false; } }
public bool RemoveAllQuotesAndTrades() { try { using (LoanPriceEntities context = new LoanPriceEntities()) { List<QuotesAndTrades> quotesAndTrades = context.QuotesAndTrades.ToList(); for (int i = 0; i < quotesAndTrades.Count; i++) { context.DeleteObject(quotesAndTrades[i]); } context.SaveChanges(); return true; } } catch (Exception) { return false; } }