Beispiel #1
0
 public ActionResult Edit(Category cat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cat).State = System.Data.Entity.EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(cat);
 }
Beispiel #2
0
 public ActionResult AddCategory(Category cat)
 {
     if (ModelState.IsValid)
     {
         db.Categories.Add(cat);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(cat);
 }