Exemplo n.º 1
0
 private static BookWithAuthors mapBookWithAuthors(book b)
 {
     BookWithAuthors bookandauthers = new BookWithAuthors();
     bookandauthers.Book = b;
     bookandauthers.Authors = AuthorService.GetAuthersByBook(b.ISBN);
     return bookandauthers;
 }
Exemplo n.º 2
0
        public static bool StoreBook(book b, int copies, string library)
        {
            BookRepository.StoreBook(b);
            for (int i = 0; i < copies; i++)
                CopyService.CreateCopy(b.ISBN, library);

            return true;
        }
Exemplo n.º 3
0
        public static BookWithAuthorsAndAuthors MapBookWithAuthorsAndAuthors(book b)
        {
            BookWithAuthorsAndAuthors baa = new BookWithAuthorsAndAuthors();
            baa.Book = b;
            baa.Authors = AuthorService.GetAuthors("FirstName");
            baa.BookAuthors = AuthorService.GetAuthersByBook(b.ISBN);

            return baa;
        }
        public ActionResult Book(book Book)
        {
            if (new Auth((BorrowerWithUser)Session["User"]).HasAdminPermission())
            {
                if (ModelState.IsValid)
                {
                    BookService.UpdateBook(Book);

                    TempData["Alert"] = AlertView.Build("Du har uppdaterat bokens uppgifter", AlertType.Success);

                    return View(BookService.GetBookWithAuthorsAndAuthors(Book.ISBN));
                }

               TempData["Alert"] = AlertView.BuildErrors(ViewData);

                return View(BookService.GetBookWithAuthorsAndAuthors(Book.ISBN));
            }

            return Redirect("/Error/Code/403");
        }
Exemplo n.º 5
0
 public static void UpdateBook(book b)
 {
     BookRepository.UpdateBook(b);
 }