Пример #1
0
 public ActionResult Create(BookEntity newBook, HttpPostedFileBase imageUpload)
 {
     newBook.PartitionKey = Guid.NewGuid().ToString();
     newBook.RowKey       = newBook.BookID.ToString();
     newBook.BookImage    = bookData.ImageURL(imageUpload);
     bookData.AddBook(newBook);
     ViewBag.Msg = "Save completed.";
     return(View());
 }
Пример #2
0
        public ActionResult Create(BookEntity newBook, HttpPostedFileBase imageUpload)
        {
            //Check image is valid
            String msg = bookData.ValidateImage(imageUpload);

            if (msg != null)
            {
                ViewBag.Msg = msg;
                return(View());
            }
            else
            {
                newBook.PartitionKey = Guid.NewGuid().ToString();
                newBook.RowKey       = newBook.BookID.ToString();
                newBook.BookImage    = bookData.ImageURL(imageUpload);
                bookData.AddBook(newBook);
                ViewBag.Msg = "Save completed.";
                return(View());
            }
        }