public ActionResult Create(Book book) { if (!ModelState.IsValid) { return View(book); } RavenSession.Store(book); return Json("Book was successfully added and was assigned the ID " + book.Id, JsonRequestBehavior.AllowGet); }
public ActionResult Edit(int id, Book input) { var book = RavenSession.Load<Book>(id); if (book == null) return HttpNotFound("Requested book wasn't found in the system"); book.Title = input.Title; book.Author = input.Author; book.Description = input.Description; book.Price = input.Price; book.YearPublished = input.YearPublished; // And so on... return Json("Book was edited successfully", JsonRequestBehavior.AllowGet); }