private List <Book>[] GetArrayWithListsOfAllBooksInEachAgeGroup() { var allBorrows = borrowManager.GetAllBorrows(); List <Book>[] books = new List <Book> [10]; int a = 0; for (int i = 9; i < 100; i += 10) { books[a] = new List <Book>(); foreach (Borrow borrow in allBorrows) { int age = DateTime.Now.Year - borrow.Customer.DateOfBirth.Year; if (age <= i && age > (i - 10)) { books[a].Add(borrow.Book); } } a++; } return(books); }
private List <Borrow> GetListOfAllBorrowsLastSixMonths() { return(borrowManager.GetAllBorrows().FindAll(b => b.DateOfBorrow >= DateTime.Today.AddMonths(-6))); }