예제 #1
0
        public ActionResult Create(DailyDiet dailydiet)
        {
            if (ModelState.IsValid) {
                ddb.DailyDiet.Add(dailydiet);
                ddb.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(dailydiet);
        }
예제 #2
0
 public ActionResult Edit(DailyDiet dailydiet)
 {
     if (ModelState.IsValid) {
         ddb.Entry(dailydiet).State = EntityState.Modified;
         ddb.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(dailydiet);
 }