예제 #1
0
        // GET: BooksController/Details/5
        public ActionResult Details(int id)
        {
            Book BookInList = bookRepository.Find(id);

            if (BookInList == null)
            {
                int BookId = id;
                return(View("BookNotFound", BookId));
            }
            return(View(BookInList));
        }
예제 #2
0
        public ActionResult Create(BookAuthorViewModel newBookAuthor)
        {
            //Saving File Or Image
            string uploads  = Path.Combine(Hosting.WebRootPath, "Uploads");
            string FileName = newBookAuthor.File.FileName;
            string FullPath = Path.Combine(uploads, FileName);

            newBookAuthor.File.CopyTo(new FileStream(FullPath, FileMode.Create));

            var  author  = authorRepository.Find(newBookAuthor.Book.Author.ID);
            var  Book    = newBookAuthor.Book;
            Book newBook = new Book
            {
                ID          = Book.ID,
                Title       = Book.Title,
                Description = Book.Description,
                Author      = author,
                //Saving File Or Image
                ImageUrl = FileName
            };

            bookRepository.Add(newBook);
            return(RedirectToAction("Index"));
        }
예제 #3
0
        // GET: AuthorController/Details/5
        public ActionResult Details(int id)
        {
            Author AuthorInList = bookRepository.Find(id);

            return(View(AuthorInList));
        }