//public BookWebApiController() { } public IHttpActionResult GetAllBooks() { var model = mapper.Map <ICollection <IndexBookViewModel> >(books.GetAll()); if (model.Count == 0) { return(NotFound()); } return(Ok(model.ToList())); }
public static void BookSearch(string name, IBookLogic bookLogic) { foreach (var item in bookLogic.GetAll().ToList()) { if (name == item.Title) { Console.WriteLine($"{item.ID}. {item.Title} {item.IDAuthor} {item.IDGenre} {item.IDLanguage} {item.IDPublishingHouse}"); } } }
public ActionResult ReaderBookIssuance(int libraryCard) { TempData["FullName"] = _readersLogic.GetById(libraryCard).ReaderFullName; TempData["LibraryCard"] = libraryCard; List <BookCopyTitleModel> bookCopyModels = new List <BookCopyTitleModel>(); List <BookCopy> bookCopies = _bookCopyLogic.GetAll(); List <Book> books = _bookLogic.GetAll(); foreach (BookCopy bc in bookCopies) { Book book = books.Find(b => b.BookID == bc.BookID); bookCopyModels.Add(new BookCopyTitleModel(bc.BookCopyID, book.BookID, book.BookTitle)); } TempData["BookCopy"] = bookCopyModels; TempData["BookIssuance"] = _mapper.Map <List <BookIssuanceModel> >(_issuanceLogic.GetAll().FindAll(bi => bi.LibraryCard == libraryCard)); return(RedirectToAction("GetBookIssuance")); }
public static void AddBookToReaderList(int bookID, int readerID, IReaderBooksLogic readerBooksLogic, IBookLogic bookLogic, IReaderLogic readerLogic) { bool isExistedBook = false; foreach (var item in bookLogic.GetAll().ToList()) { if (item.ID == bookID) { isExistedBook = true; } } if (isExistedBook) { readerBooksLogic.Add(new ReadersBooks(readerID, bookID)); } else { Console.WriteLine("Вы ввели некорректное значение"); } }
// GET: Book public ActionResult Index() { var model = mapper.Map <IEnumerable <IndexBookViewModel> >(books.GetAll()); return(View(model)); }
public async Task <IActionResult> GetAll() { var books = await _bookLogic.GetAll(); return(Ok(books)); }
public ActionResult AllBooks() { ViewData["ph"] = _mapper.Map <List <PublishingHouseModel> >(_publishingHouseLogic.GetAll()); return(View(_mapper.Map <List <BookModel> >(_bookLogic.GetAll()))); }