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

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