public void LazyLoad() { _screenHelper.Reset(); var sw = new Stopwatch(); _screenHelper.PrintLazyLoading(); using (var context = new DataContext()) { sw.Start(); var books = context.Books.ToList <Book>(); foreach (var book in books) { if (book.Reader?.Address?.Street != null) { Console.WriteLine(book.Reader.Address.Street); } } sw.Stop(); } _screenHelper.PrintElapsedTime(sw.Elapsed); _menuHelper.NavigateToMainMenu(); }
public void ListAllBooks() { _screenHelper.Reset(); _screenHelper.PrintBookListingText(); var books = _bookrepository.GetAllBooks(); ListBooks(books); _menuHelper.NavigateToMainMenu(); }
public void GenerateData(int amount, IBorrow borrow) { GenerateBooks(amount); GenerateReaders(amount, borrow); _screenHelper.Reset(); _screenHelper.PrintSuccessfulSeeding(); _menuHelper.NavigateToMainMenu(); }
public void AddNewBook() { _screenHelper.Reset(); var book = _screenHelper.GetNewBookDetails(); _bookrepository.StoreABook(book); _screenHelper.PrintBookAddedMessage(book); _menuHelper.NavigateToMainMenu(); }
public void ReturnBook() { _screenHelper.Reset(); var id = _screenHelper.GetBookId(); var book = _bookRepository.ReturnABook(id); if (book == null) { Console.WriteLine(Texts.NoBook); } _menuHelper.NavigateToMainMenu(); }
private void SearchBy(string property, Func <Book, string, bool> expression) { _screenHelper.Reset(); var input = _screenHelper.ReadInputString(property); var books = _bookRepository.GetAllBooks(); var result = books.Where(b => expression(b, input)).ToList(); _screenHelper.PrintSearchResult(result); _menuHelper.NavigateToMainMenu(); }
public void PerformBorrowingProcess() { _screenHelper.Reset(); var id = _screenHelper.GetBookId(); var reader = _screenHelper.GetNewReader(); var daysToBorrow = _screenHelper.GetBorrowDays(); var book = BorrowSingleBook(id, reader, daysToBorrow); _screenHelper.PrintBookBorrowedMessage(book, reader); _menuHelper.NavigateToMainMenu(); }