Exemplo n.º 1
0
        public ActionResult Create(Book book)
        {
            if (ModelState.IsValid)
            {
                db.Books.Add(book);
                db.SaveChanges();
                //return RedirectToAction("Index");
            }

            return View(book);
        }
Exemplo n.º 2
0
        public ActionResult Edit(Book book)
        {
            if (ModelState.IsValid)
            {
                db.Entry(book).State = EntityState.Modified;
                db.SaveChanges();
               // return RedirectToAction("Index");
            }

            else if (Request.IsAjaxRequest())
            {
                return PartialView("_Edit", book);
            }
            return View(book);
        }