Esempio n. 1
0
        public ActionResult Create(Categories categories)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(categories);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(categories);
        }
Esempio n. 2
0
 public ActionResult Edit(Categories categories)
 {
     if (ModelState.IsValid)
     {
         db.Entry(categories).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(categories);
 }