Exemplo n.º 1
0
        public ActionResult Create(Product product)
        {
            if (ModelState.IsValid)
            {
                ac.db.Products.Add(product);
                ac.db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(product);
        }
Exemplo n.º 2
0
 public ActionResult Edit(Product product)
 {
     if (ModelState.IsValid)
     {
         ac.db.Entry(product).State = EntityState.Modified;
         ac.db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(product);
 }