public IHttpActionResult Post(Book book) { Book bk = bookRepo.AddNewBook(book); if (book == null) { return(NotFound()); } return(Ok(bk)); }
public ActionResult Create([Bind(Include = "Id,Title,PublicationYear,IsAvailable,AuthorId,CostId,Created,RowVersion")] Book book) { if (ModelState.IsValid) { bookrepo.AddNewBook(book); return(RedirectToAction("Index")); } ViewBag.AuthorId = new SelectList(db.Authors, "Id", "FirstName", book.AuthorId); ViewBag.CostId = new SelectList(db.Costs, "Id", "Id", book.CostId); return(View(book)); }