Esempio n. 1
0
 public ActionResult Create(Foods foods)
 {
     if (ModelState.IsValid)
         {
             db.Foods.Add(foods);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
         return View(foods);
 }
Esempio n. 2
0
 public ActionResult Edit(int id, Foods foods)
 {
     if (ModelState.IsValid)
     {
         db.Entry(foods).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(foods);
 }