public ActionResult Create([Bind(Include = "ID,Category")] Categories categories)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(categories);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(categories));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "Id,Title,author,ISBN,Category,Cost")] Books books)
        {
            if (ModelState.IsValid)
            {
                db.Books.Add(books);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(books));
        }