public ActionResult Details(int id, string sortOrder)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            PublishersRepository publishersRepository = new PublishersRepository(context);
            BooksRepository booksRepository = new BooksRepository(context);
            PublishersDetailsVM model = new PublishersDetailsVM();
            this.TryUpdateModel(model);

            var publisher = publishersRepository.GetByID(id);
            if (publisher != null)
            {
                model.ID = publisher.ID;
                model.PublisherName = publisher.Name;
                model.Address = publisher.Address;
                model.BooksPager = model.BooksPager ?? new GenericPagerVM();
                model.BooksPager.CurrentPage = model.BooksPager.CurrentPage == 0 ? 1 : model.BooksPager.CurrentPage;
                model.BooksPager.Action = "Details";
                model.BooksPager.Controller = "Publishers";
                model.BooksPager.Prefix = "BooksPager";
                model.BooksPager.CurrentParameters = new Dictionary<string, object>()
                {
                    { "BookTitle", model.BookTitle },
                    { "BooksPager.CurrentPage", model.BooksPager.CurrentPage }
                };

                #region Sorting and Filtering

                Expression<Func<Book, bool>> filter = b =>
                            (string.IsNullOrEmpty(model.BookTitle) || b.Title.Contains(model.BookTitle));
                model.BooksPager.PagesCount = GetPagesCount(filter);

                ViewBag.BookSortParam = string.IsNullOrEmpty(sortOrder) ? "book_desc" : "";
                switch (sortOrder)
                {
                    case "book_desc":
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, x => x.OrderByDescending(b => b.Title))
                            .Where(b => b.PublisherID == id)
                            .ToList();
                        break;
                    default:
                        model.Books = booksRepository
                           .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, x => x.OrderBy(b => b.Title))
                           .Where(b => b.PublisherID == id)
                           .ToList();
                        break;
                }
                #endregion

                return View(model);
            }
            else
            {
                return RedirectToAction("Index", "Publishers");
            }
        }
        public ActionResult EditRent()
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            BooksRepository booksRepository = new BooksRepository(context);
            CustomersRepository customersRepository = new CustomersRepository(context);
            RentsEditRentVM model = new RentsEditRentVM();

            model.Customers = customersRepository.GetAll();
            model.Books = booksRepository.GetAll();
            model.RentDate = DateTime.Now.Date;
            model.UserID = AuthenticationManager.LoggedUser.ID;

            return View(model);
        }
예제 #3
0
 private void RefreshStudentsAndBooksList()
 {
     _studentsRepository.GetAll().ForEach(student => studentsListBox.Items.Add(student));
     _booksRepository.GetAll().ForEach(book => booksListBox.Items.Add(book));
 }
        public ActionResult ReturnBook(string bookInfo, BooksReturnBookVM model)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            BooksRepository booksRepository = new BooksRepository(context);

            // makes an book info array in format {Barcode No.}{Empty}{Empty}{Book title}
            string[] bookInfoSplitted = bookInfo.Split(' ', '-');

            if (string.IsNullOrEmpty(bookInfo) || bookInfoSplitted[0] == "")
            {
                ModelState.AddModelError("BookBarcodeNumber", "* barcode required");
            }
            if (!ModelState.IsValid)
            {
                model.DateReturned = DateTime.Now;
                model.Books = booksRepository.GetAll();

                return View(model);
            }

            model.BookBarcodeNumber = int.Parse(bookInfoSplitted[0]);
            Book book = booksRepository
                .GetAll(filter: b => b.Barcodes.FirstOrDefault().BarcodeNumber == model.BookBarcodeNumber)
                .FirstOrDefault();
            book.StockCount++;
            booksRepository.Save(book);

            return RedirectToAction("Index", "Books");
        }
        public ActionResult ReturnBook()
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            BooksRepository booksRepository = new BooksRepository(context);
            BooksReturnBookVM model = new BooksReturnBookVM();

            model.DateReturned = DateTime.Now.Date;
            model.Books = booksRepository.GetAll();

            return View(model);
        }
        public ActionResult Index(string sortOrder)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            BooksRepository booksRepository = new BooksRepository(context);
            BooksIndexVM model = new BooksIndexVM();
            this.TryUpdateModel(model);

            model.BooksPager = model.BooksPager ?? new GenericPagerVM();
            model.BooksPager.CurrentPage = model.BooksPager.CurrentPage == 0 ? 1 : model.BooksPager.CurrentPage;
            model.BooksPager.Prefix = "BooksPager";
            model.BooksPager.Action = "Index";
            model.BooksPager.Controller = "Books";
            model.BooksPager.CurrentParameters = new Dictionary<string, object>()
            {
                { "Title", model.Title },
                { "Publisher", model.Publisher },
                { "BooksPager.CurrentPage", model.BooksPager.CurrentPage }
            };

            #region Sorting and Filtering
            Expression<Func<Book, bool>> filter = b =>
                   (string.IsNullOrEmpty(model.Title) || b.Title.Contains(model.Title)) &&
                   (string.IsNullOrEmpty(model.Publisher) || b.Publisher.Name.Contains(model.Publisher));
            model.BooksPager.PagesCount = GetPagesCount(filter);

            ViewBag.TitleSortParam = string.IsNullOrEmpty(sortOrder) ? "title_desc" : "";
            ViewBag.PublisherSortParam = sortOrder == "Publisher" ? "publisher_desc" : "Publisher";
            ViewBag.StockCountSortParam = sortOrder == "StockCount" ? "stockCount_desc" : "StockCount";
            switch (sortOrder)
            {
                case "title_desc":
                    model.BooksList = booksRepository
                        .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Title))
                        .ToList();
                    break;
                case "Publisher":
                    model.BooksList = booksRepository
                        .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Publisher.Name))
                        .ToList();
                    break;
                case "publisher_desc":
                    model.BooksList = booksRepository
                        .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Publisher.Name))
                        .ToList();
                    break;
                case "StockCount":
                    model.BooksList = booksRepository
                        .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.StockCount))
                        .ToList();
                    break;
                case "stockCount_desc":
                    model.BooksList = booksRepository
                        .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.StockCount))
                        .ToList();
                    break;
                default:
                    model.BooksList = booksRepository
                        .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Title))
                        .ToList();
                    break;
            }
            #endregion

            return View(model);
        }
예제 #7
0
        public ActionResult EditRent(string customerInfo, string bookInfo, RentsEditRentVM model)
        {
            LibraryManagementSystemContext context  = new LibraryManagementSystemContext();
            RentsRepository     rentsRepository     = new RentsRepository(context);
            BooksRepository     booksRepository     = new BooksRepository(context);
            CustomersRepository customersRepository = new CustomersRepository(context);

            // makes an customer info array in format {Personal No.}{Empty}{Empty}{First name}{Last name}
            string[] customerInfoSplitted = customerInfo.Split(' ', '-');

            // makes an book info array in format {Barcode No.}{Empty}{Empty}{Book title}
            string[] bookInfoSplitted = bookInfo.Split(' ', '-');

            if (string.IsNullOrEmpty(customerInfo) || customerInfoSplitted[0] == "")
            {
                ModelState.AddModelError("CustomerPersonalNumber", "* personal No. required");
            }
            if (string.IsNullOrEmpty(bookInfo) || bookInfoSplitted[0] == "")
            {
                ModelState.AddModelError("BookBarcodeNumber", "* barcode required");
            }
            if (!ModelState.IsValid)
            {
                if (model.ID <= 0)
                {
                    model.RentDate = DateTime.Now;
                }

                model.Customers = customersRepository.GetAll();
                model.Books     = booksRepository.GetAll();

                return(View(model));
            }

            model.CustomerPersonalNumber = int.Parse(customerInfoSplitted[0]);
            model.Customer = customersRepository
                             .GetAll(filter: c => c.PersonalNumber == model.CustomerPersonalNumber)
                             .FirstOrDefault();

            model.BookBarcodeNumber = int.Parse(bookInfoSplitted[0]);
            model.Books             = booksRepository
                                      .GetAll(filter: b => b.Barcodes.Any(bc => bc.BarcodeNumber == model.BookBarcodeNumber));

            if (model.Books.Any(b => b.StockCount > 0))
            {
                Rent rent = new Rent();
                rent.Books = new List <Book>();
                rent.Books = model.Books;
                rent.Books.FirstOrDefault().StockCount--;
                rent.DateToReturn = DateTime.Now.AddMonths(1);
                rent.RentDate     = model.RentDate;
                rent.UserID       = model.UserID;
                rent.CustomerID   = model.Customer.ID;

                rentsRepository.Save(rent);
            }
            else
            {
                ModelState.AddModelError("BookBarcodeNumber", "* book not in stock at the moment");

                if (model.ID <= 0)
                {
                    model.RentDate = DateTime.Now;
                }

                model.Customers = customersRepository.GetAll();
                model.Books     = booksRepository.GetAll();

                return(View(model));
            }

            return(RedirectToAction("Index", "Rents"));
        }
예제 #8
0
 public List <Category> GetAll()
 {
     return(_BooksRepository.GetAll());
 }
예제 #9
0
        public ActionResult Index(string sortOrder)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            BooksRepository booksRepository        = new BooksRepository(context);
            BooksIndexVM    model = new BooksIndexVM();

            this.TryUpdateModel(model);

            model.BooksPager                   = model.BooksPager ?? new GenericPagerVM();
            model.BooksPager.CurrentPage       = model.BooksPager.CurrentPage == 0 ? 1 : model.BooksPager.CurrentPage;
            model.BooksPager.Prefix            = "BooksPager";
            model.BooksPager.Action            = "Index";
            model.BooksPager.Controller        = "Books";
            model.BooksPager.CurrentParameters = new Dictionary <string, object>()
            {
                { "Title", model.Title },
                { "Publisher", model.Publisher },
                { "BooksPager.CurrentPage", model.BooksPager.CurrentPage }
            };

            #region Sorting and Filtering
            Expression <Func <Book, bool> > filter = b =>
                                                     (string.IsNullOrEmpty(model.Title) || b.Title.Contains(model.Title)) &&
                                                     (string.IsNullOrEmpty(model.Publisher) || b.Publisher.Name.Contains(model.Publisher));
            model.BooksPager.PagesCount = GetPagesCount(filter);

            ViewBag.TitleSortParam      = string.IsNullOrEmpty(sortOrder) ? "title_desc" : "";
            ViewBag.PublisherSortParam  = sortOrder == "Publisher" ? "publisher_desc" : "Publisher";
            ViewBag.StockCountSortParam = sortOrder == "StockCount" ? "stockCount_desc" : "StockCount";
            switch (sortOrder)
            {
            case "title_desc":
                model.BooksList = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Title))
                                  .ToList();
                break;

            case "Publisher":
                model.BooksList = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Publisher.Name))
                                  .ToList();
                break;

            case "publisher_desc":
                model.BooksList = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Publisher.Name))
                                  .ToList();
                break;

            case "StockCount":
                model.BooksList = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.StockCount))
                                  .ToList();
                break;

            case "stockCount_desc":
                model.BooksList = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.StockCount))
                                  .ToList();
                break;

            default:
                model.BooksList = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Title))
                                  .ToList();
                break;
            }
            #endregion

            return(View(model));
        }
예제 #10
0
 public string GetAll(String searchString)
 {
     return(JsonConvert.SerializeObject(_repo.GetAll(searchString).ToArray()));
 }
예제 #11
0
 public PartialViewResult GetAll(string searchString)
 {
     return(PartialView(partialView, _repo.GetAll(searchString)));
 }
        public ActionResult Details(int id, string sortOrder)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            AuthorsRepository authorsRepository = new AuthorsRepository(context);
            BooksRepository booksRepository = new BooksRepository(context);
            AuthorsDetailsVM model = new AuthorsDetailsVM();
            this.TryUpdateModel(model);

            Author author = authorsRepository.GetByID(id);
            if (author != null)
            {
                model.ID = author.ID;
                model.AuhtorName = author.ToString();
                model.BooksPager = model.BooksPager ?? new GenericPagerVM();
                model.BooksPager.CurrentPage = model.BooksPager.CurrentPage == 0 ? 1 : model.BooksPager.CurrentPage;
                model.BooksPager.Action = "Details";
                model.BooksPager.Controller = "Authors";
                model.BooksPager.Prefix = "BooksPager";
                model.BooksPager.CurrentParameters = new Dictionary<string, object>()
                {
                    { "BookTitle", model.BookTitle },
                    { "PublisherName", model.PublisherName },
                    { "BooksPager.CurrentPage", model.BooksPager.CurrentPage }
                };

                #region Sorting and Filtering
                Expression<Func<Book, bool>> filter = b =>
                           (string.IsNullOrEmpty(model.BookTitle) || b.Title.Contains(model.BookTitle)) &&
                           (string.IsNullOrEmpty(model.PublisherName) || b.Publisher.Name.Contains(model.PublisherName));
                model.BooksPager.PagesCount = GetPagesCount(filter);

                ViewBag.TitleSortParam = string.IsNullOrEmpty(sortOrder) ? "title_desc" : "";
                ViewBag.PublisherSortParam = sortOrder == "Publisher" ? "publisher_desc" : "Publisher";
                ViewBag.StockCountSortParam = sortOrder == "StockCount" ? "stockCount_desc" : "StockCount";
                switch (sortOrder)
                {
                    case "title_desc":
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Title))
                            .Where(b => b.Authors.Any(a => a.ID == id))
                            .ToList();
                        break;
                    case "Publisher":
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Publisher.Name))
                            .Where(b => b.Authors.Any(a => a.ID == id))
                            .ToList();
                        break;
                    case "publisher_desc":
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Publisher.Name))
                            .Where(b => b.Authors.Any(a => a.ID == id))
                            .ToList();
                        break;
                    case "StockCount":
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.StockCount))
                            .Where(b => b.Authors.Any(a => a.ID == id))
                            .ToList();
                        break;
                    case "stockCount_desc":
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.StockCount))
                            .Where(b => b.Authors.Any(a => a.ID == id))
                            .ToList();
                        break;
                    default:
                        model.Books = booksRepository
                            .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Title))
                            .Where(b => b.Authors.Any(a => a.ID == id))
                            .ToList();
                        break;
                }
                #endregion

                return View(model);
            }
            else
            {
                return RedirectToAction("Index", "Authors");
            }
        }
예제 #13
0
 public IEnumerable <Book> GetAllBooks()
 {
     return(_repo.GetAll("").OrderBy(b => b.ReleaseDate));
 }
예제 #14
0
 public IEnumerable <Books> GetAll()
 {
     return(_BooksRepository.GetAll());
 }
예제 #15
0
 public IEnumerable <Book> GetAll()
 {
     return(_repo.GetAll());
 }
        public ActionResult EditRent(string customerInfo, string bookInfo, RentsEditRentVM model)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            RentsRepository rentsRepository = new RentsRepository(context);
            BooksRepository booksRepository = new BooksRepository(context);
            CustomersRepository customersRepository = new CustomersRepository(context);

            // makes an customer info array in format {Personal No.}{Empty}{Empty}{First name}{Last name}
            string[] customerInfoSplitted = customerInfo.Split(' ', '-');

            // makes an book info array in format {Barcode No.}{Empty}{Empty}{Book title}
            string[] bookInfoSplitted = bookInfo.Split(' ', '-');

            if (string.IsNullOrEmpty(customerInfo) || customerInfoSplitted[0] == "")
            {
                ModelState.AddModelError("CustomerPersonalNumber", "* personal No. required");
            }
            if (string.IsNullOrEmpty(bookInfo) || bookInfoSplitted[0] == "")
            {
                ModelState.AddModelError("BookBarcodeNumber", "* barcode required");
            }
            if (!ModelState.IsValid)
            {
                if (model.ID <= 0)
                {
                    model.RentDate = DateTime.Now;
                }

                model.Customers = customersRepository.GetAll();
                model.Books = booksRepository.GetAll();

                return View(model);
            }

            model.CustomerPersonalNumber = int.Parse(customerInfoSplitted[0]);
            model.Customer = customersRepository
                .GetAll(filter: c => c.PersonalNumber == model.CustomerPersonalNumber)
                .FirstOrDefault();

            model.BookBarcodeNumber = int.Parse(bookInfoSplitted[0]);
            model.Books = booksRepository
                .GetAll(filter: b => b.Barcodes.Any(bc => bc.BarcodeNumber == model.BookBarcodeNumber));

            if (model.Books.Any(b => b.StockCount > 0))
            {
                Rent rent = new Rent();
                rent.Books = new List<Book>();
                rent.Books = model.Books;
                rent.Books.FirstOrDefault().StockCount--;
                rent.DateToReturn = DateTime.Now.AddMonths(1);
                rent.RentDate = model.RentDate;
                rent.UserID = model.UserID;
                rent.CustomerID = model.Customer.ID;

                rentsRepository.Save(rent);
            }
            else
            {
                ModelState.AddModelError("BookBarcodeNumber", "* book not in stock at the moment");

                if (model.ID <= 0)
                {
                    model.RentDate = DateTime.Now;
                }

                model.Customers = customersRepository.GetAll();
                model.Books = booksRepository.GetAll();

                return View(model);
            }

            return RedirectToAction("Index", "Rents");
        }
 public ActionResult List()
 {
     return(View(books.GetAll()));
 }
예제 #18
0
        public ActionResult Details(int id, string sortOrder)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            AuthorsRepository authorsRepository    = new AuthorsRepository(context);
            BooksRepository   booksRepository      = new BooksRepository(context);
            AuthorsDetailsVM  model = new AuthorsDetailsVM();

            this.TryUpdateModel(model);

            Author author = authorsRepository.GetByID(id);

            if (author != null)
            {
                model.ID                           = author.ID;
                model.AuhtorName                   = author.ToString();
                model.BooksPager                   = model.BooksPager ?? new GenericPagerVM();
                model.BooksPager.CurrentPage       = model.BooksPager.CurrentPage == 0 ? 1 : model.BooksPager.CurrentPage;
                model.BooksPager.Action            = "Details";
                model.BooksPager.Controller        = "Authors";
                model.BooksPager.Prefix            = "BooksPager";
                model.BooksPager.CurrentParameters = new Dictionary <string, object>()
                {
                    { "BookTitle", model.BookTitle },
                    { "PublisherName", model.PublisherName },
                    { "BooksPager.CurrentPage", model.BooksPager.CurrentPage }
                };

                #region Sorting and Filtering
                Expression <Func <Book, bool> > filter = b =>
                                                         (string.IsNullOrEmpty(model.BookTitle) || b.Title.Contains(model.BookTitle)) &&
                                                         (string.IsNullOrEmpty(model.PublisherName) || b.Publisher.Name.Contains(model.PublisherName));
                model.BooksPager.PagesCount = GetPagesCount(filter);

                ViewBag.TitleSortParam      = string.IsNullOrEmpty(sortOrder) ? "title_desc" : "";
                ViewBag.PublisherSortParam  = sortOrder == "Publisher" ? "publisher_desc" : "Publisher";
                ViewBag.StockCountSortParam = sortOrder == "StockCount" ? "stockCount_desc" : "StockCount";
                switch (sortOrder)
                {
                case "title_desc":
                    model.Books = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Title))
                                  .Where(b => b.Authors.Any(a => a.ID == id))
                                  .ToList();
                    break;

                case "Publisher":
                    model.Books = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Publisher.Name))
                                  .Where(b => b.Authors.Any(a => a.ID == id))
                                  .ToList();
                    break;

                case "publisher_desc":
                    model.Books = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.Publisher.Name))
                                  .Where(b => b.Authors.Any(a => a.ID == id))
                                  .ToList();
                    break;

                case "StockCount":
                    model.Books = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.StockCount))
                                  .Where(b => b.Authors.Any(a => a.ID == id))
                                  .ToList();
                    break;

                case "stockCount_desc":
                    model.Books = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderByDescending(b => b.StockCount))
                                  .Where(b => b.Authors.Any(a => a.ID == id))
                                  .ToList();
                    break;

                default:
                    model.Books = booksRepository
                                  .GetAll(model.BooksPager.CurrentPage, ApplicationConfiguration.ItemsPerPage, filter, order: x => x.OrderBy(b => b.Title))
                                  .Where(b => b.Authors.Any(a => a.ID == id))
                                  .ToList();
                    break;
                }
                #endregion

                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index", "Authors"));
            }
        }
예제 #19
0
        public IActionResult GetAll()
        {
            IList <Book> books = _repo.GetAll();

            return(new OkObjectResult(books));
        }
예제 #20
0
 public ActionResult Index()
 {
     return(View(_repo.GetAll("")));
 }
예제 #21
0
        // GET: api/Books
        public IEnumerable <Book> Get()
        {
            BooksRepository booksRepo = new BooksRepository();

            return(booksRepo.GetAll());
        }
예제 #22
0
        public void GetAll_Test()
        {
            IEnumerable <Book> books = _repository.GetAll();

            Assert.IsNotNull(books);
        }