Exemplo n.º 1
0
        public ActionResult Create(Book book)
        {
            if (ModelState.IsValid)
            {
                BookManager.Create(book);
                //TODO: Create FilePath or file upload field
                Utilities.Import.ImportItem("");
                return RedirectToAction("Index");
            }

            return View(book);
        }
Exemplo n.º 2
0
        public ActionResult Edit(Book book)
        {
            // HACK allows us to set the book collection to empty
            if (Request.Form["BookCollection.Id"] == String.Empty)
            {
                ViewBag.BookCollection = new SelectList(BookCollectionManager.GetAll(), "Id", "Title", book.BookCollection.Id);
                book.BookCollection = null;
                ModelState.Remove("BookCollection.Id");
            }

            if (ModelState.IsValid)
            {
                BookManager.Edit(book);
                return RedirectToAction("Index");
            }

            return View(book);
        }