Esempio n. 1
0
        public static AuthorWithBooks MapAuthorWithBooks(author a)
        {
            AuthorWithBooks authorwithbooks = new AuthorWithBooks();
            authorwithbooks.Author = a;
            authorwithbooks.Books = BookService.GetBooksByAuthor(a.Aid);

            return authorwithbooks;
        }
Esempio n. 2
0
        public static AuthorWithBooksAndBooks MapAuthorWithBooksAndClassifications(AuthorWithBooks a)
        {
            AuthorWithBooksAndBooks aw = new AuthorWithBooksAndBooks();
            aw.Author = a.Author;
            aw.AuthorBooks = a.Books;
            aw.Books = BookService.GetBooks();

            return aw;
        }
        /// <summary>
        /// Removes an author
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        public ActionResult Remove(AuthorWithBooks a)
        {
            if (new Auth((BorrowerWithUser)Session["User"]).HasAdminPermission())
            {
                AuthorService.DeleteAuthor(a.Author);
                TempData["Alert"] = AlertView.Build("Du har tagit bort författaren "+a.Author.FirstName+" "+a.Author.LastName, AlertType.Success);
                return RedirectToAction("Start");
            }

            return Redirect("/Error/Code/403");
        }