Ejemplo n.º 1
0
        public ActionResult AddBook(AddBookVM model)
        {

            using (ApplicationDbContext db = new ApplicationDbContext())
            {
                db.Books.Add(new Book() { AuthorId = model.AuthorId, Title = model.Title, IsHardback = model.IsHardback });
                db.SaveChanges();
            }
            return RedirectToAction("AuthorDetail", new { id = model.AuthorId });
        }
Ejemplo n.º 2
0
 public ActionResult AddBook(int id)
 {
     AddBookVM model = new AddBookVM();
     model.AuthorId = id;
     return View(model);
 }