Beispiel #1
0
        //public BookWebApiController() { }

        public IHttpActionResult GetAllBooks()
        {
            var model = mapper.Map <ICollection <IndexBookViewModel> >(books.GetAll());

            if (model.Count == 0)
            {
                return(NotFound());
            }
            return(Ok(model.ToList()));
        }
Beispiel #2
0
 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"));
        }
Beispiel #4
0
        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("Вы ввели некорректное значение");
            }
        }
Beispiel #5
0
        // GET: Book
        public ActionResult Index()
        {
            var model = mapper.Map <IEnumerable <IndexBookViewModel> >(books.GetAll());

            return(View(model));
        }
Beispiel #6
0
        public async Task <IActionResult> GetAll()
        {
            var books = await _bookLogic.GetAll();

            return(Ok(books));
        }
Beispiel #7
0
 public ActionResult AllBooks()
 {
     ViewData["ph"] = _mapper.Map <List <PublishingHouseModel> >(_publishingHouseLogic.GetAll());
     return(View(_mapper.Map <List <BookModel> >(_bookLogic.GetAll())));
 }