public void CommitLoan(ILoan loan) { if (loan == null) throw new ArgumentException("Error: loan can\'t be null."); loan.Commit(_loans.Count); _loans.Add(loan); }
public void CommitLoan(ILoan loan) { var newId = this.LoanList.Count == 0 ? 1 : this.LoanList.Max(l => l.ID) + 1; loan.Commit(newId); this.LoanList.Add(loan); }
public void CommitLoan(ILoan loan) { if (loan == null) { throw new ArgumentException( String.Format("LoanDAO : commitLoans : loan cannot be null.")); } IMember borrower = loan.Borrower; borrower.AddLoan(loan); IBook book = loan.Book; book.Borrow(loan); loan.Commit(); int id = loan.ID; loanDict.Add(id, loan); }