Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(ViewModels.Book.Delete model)
        {
            var book = db.Books.Find(model.Id);

            db.Books.Remove(book);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        // GET: Books/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Books books = db.Books.Find(id);

            if (books == null)
            {
                return(HttpNotFound());
            }
            var model = new ViewModels.Book.Delete(books);

            return(View(model));
        }