public ActionResult Index()
        {
            var bookService = new BookListingService(this.Server);
            var books       = bookService.GetBookListingViews();

            return(View(books));
        }
        public ActionResult Index()
        {
            var bookService = new BookListingService(this.listingsFolder, this.imagesFolder);
            var listings    = bookService.GetBookListings();
            var books       = this.GetBookListingModels(listings);

            return(View(books));
        }
        public ActionResult SubmitPost(SubmitBookViewModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }

            var bookService = new BookListingService(this.Server);
            var newListing  = BookListing.New(model.BookTitle, model.BookDescription, model.Price);

            bookService.SaveNewListing(newListing);

            if (model.BookImage != null)
            {
                var imageService = new ImageProcessingService(this.Server);
                imageService.ProcessImage(model.BookImage.InputStream, newListing);
            }

            return(this.RedirectToAction("Index", "Books"));
        }
        public ActionResult SubmitPost(BookListingSubmissionModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(model));
            }

            var bookService = new BookListingService(this.listingsFolder, this.imagesFolder);
            var newListing  = BookListing.New(model.BookTitle, model.BookDescription, model.Price);

            if (model.BookImage != null)
            {
                var imageService = new ImageProcessingService(this.imagesFolder);
                imageService.ProcessImage(model.BookImage.OpenReadStream(), newListing);
            }

            bookService.SaveNewListing(newListing);

            return(this.RedirectToAction("Index", "Books"));
        }