public IActionResult Index() { var books = _bookService.GetAll(); var bookListing = books.Select(b => new BookListingModel { Title = b.Title, AuthorId = b.AuthorId, ImageUrl = b.ImageUrl, GenreId = b.GenreId, BookId = b.BookId }); var genres = _repositoryWrapper.GenreRepository.FindByCondition(g => g.Name != null); var model = new BookIndexModel { BookListing = bookListing, GenreList = genres }; return(View(model)); }
public IActionResult ListBook() { if (HttpContext.Session.GetString("username") != null) { var assetModels = _assets.GetAll(); var ListingResult = assetModels .Select(result => new BookIndexListingModel { Id = result.Id, ImageURL = result.ImageUrl, AuthorOrDirector = _assets.GetAuthorOrDirector(result.Id), DeweyCallNumber = _assets.GetDeweyIndex(result.Id), Title = result.Title, NumberOfCopies = result.NumberOfCopies.ToString(), Year = result.Year.ToString(), Status = result.Status.ToString(), Cost = result.Cost.ToString(), Location = _asset.GetCurrentLocation(result.Id)?.Name.ToString() // Location = result.Location.Name }); var model = new BookIndexModel() { Books = ListingResult }; return(View(model)); } else { return(RedirectToAction("Login", "Home")); } }
// Gets all the available books public IActionResult Available() { var model = new BookIndexModel(); model.Books = _bookService.GetAvailable(); return(View(model)); }
public ActionResult Index() { using (var bookRepo = new BookRepository()) { var books = bookRepo.GetMany(); var model = BookIndexModel.FromDomain(books); return(View(model)); } }
// Retrieves all the books and returns them to the view public IActionResult Index() { var model = new BookIndexModel() { }; var allBooks = _bookService.GetAll(); model.Books = allBooks; return(View(model)); }