public bool saveNewLoanHistory(NewLoanFinancialHistory objNewLoanFinancialHistory, Boolean IsSubmit) { bool blnValue = true; using (var dbContextTransaction = _dbContext.Database.BeginTransaction()) { try { _NewLoanFinancialHistory.Add(objNewLoanFinancialHistory); _dbContext.SaveChanges(); if (IsSubmit) { submitLoanStatus(objNewLoanFinancialHistory.LoanEntryId); } dbContextTransaction.Commit(); } catch (Exception) { blnValue = false; dbContextTransaction.Rollback(); } } return blnValue; }
public bool updateNewLoanHistory(NewLoanFinancialHistory objNewLoanFinancialHistory, Boolean IsSubmit) { bool blnValue = true; using (var dbContextTransaction = _dbContext.Database.BeginTransaction()) { try { _NewLoanFinancialHistory.Attach(objNewLoanFinancialHistory); var entry = _dbContext.Entry(objNewLoanFinancialHistory); entry.Property(e => e.BankId).IsModified = true; entry.Property(e => e.LoanAmount).IsModified = true; entry.Property(e => e.LoanDate).IsModified = true; entry.Property(e => e.LoanDuration).IsModified = true; entry.Property(e => e.LoanInterest).IsModified = true; entry.Property(e => e.LoanTypeId).IsModified = true; // entry.Property(e => e.).IsModified = true; _dbContext.SaveChanges(); if (IsSubmit) { submitLoanStatus(objNewLoanFinancialHistory.LoanEntryId); } dbContextTransaction.Commit(); } catch (Exception) { blnValue = false; dbContextTransaction.Rollback(); } } return blnValue; }