Example #1
0
        public ActionResult Create(Cook cook)
        {
            if (ModelState.IsValid)
            {
                db.Cooks.Add(cook);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(cook);
        }
Example #2
0
 public ActionResult Edit(Cook cook)
 {
     if (ModelState.IsValid)
     {
         db.Entry(cook).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(cook);
 }