コード例 #1
0
 public ActionResult Edit(Subcategory subcategory)
 {
     if (ModelState.IsValid)
     {
         db.Entry(subcategory).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(subcategory);
 }
コード例 #2
0
        public ActionResult Create(Subcategory subcategory)
        {
            if (ModelState.IsValid)
            {
                db.Subcategories.Add(subcategory);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(subcategory);
        }