/// <summary> /// create loan and store it to a file /// </summary> /// <param name="borrowDate"></param> /// <param name="period"></param> public void CreateLoan(string borrowDate, int period,string copySerialNumber) { Random rnd = new Random(); int id = rnd.Next(1, 500); while (GetloanByID(id) != null) { id = rnd.Next(1, 500); } BookController bookCtrl = new BookController(); Copy copy = bookCtrl.getCopyOfBookByCopySerialNumber(copySerialNumber); double price = copy.Price; price = price * period; copy.State = false; Loan loan = new Loan(id, borrowDate, period,price,copySerialNumber); loans.Add(loan); loanCollection.StoreLoanCollectionToFile(loans); }
public BookMenu() { bookCtrl = new BookController(); }