//adding a book to the issue book list i,e exp list // It returns true when book is added to the exp list public bool IssueABook(int sid, int bid) { int num = 0; // TO Verify whether student list has sid or not //if Student list has student then num is incremented by 1 foreach (Student student in studentList) { if (sid == student.Studentid) { num++; break; } } // TO Verify whether bookslist has bid or not //If booklist has book id then num is incremented by 1 if (num > 0) { int sum = 0; foreach (Book book in bookList) { if (bid == book.Bookid) { sum++; break; } } if (sum > 0) { //To verify whether book is issued or not // If book is issued then res is incremented by 1 int res = 0; foreach (IssueBook issueBook in exp) { if (issueBook.Bid == bid) { res++; break; } } if (res == 0) { int count = 0; foreach (IssueBook isu in exp) { if (isu.Sid == sid) { count++; } } if (count < 3) { IssueBook newIssue = new IssueBook(sid, bid); DateTime issueDate = DateTime.Now; DateTime returnDate = issueDate.AddDays(15); newIssue.IssueDate = issueDate; newIssue.Returndate = returnDate; exp.Add(newIssue); return(true); } } } } return(false); }