コード例 #1
0
 //
 // GET: /Health/Create
 public ActionResult Create(int Day, int Time)
 {
     var Ex = new Exercises();
     Ex.Day = Day;
     Ex.Time = Time;
     Ex.DayName = new DatePretty().Prettify(Day);
     return View(Ex);
 }
コード例 #2
0
        public ActionResult Create(Exercises exercises)
        {
            if (ModelState.IsValid)
            {
                db.Exercises.Add(exercises);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(exercises);
        }
コード例 #3
0
 public ActionResult Edit(Exercises exercises)
 {
     if (ModelState.IsValid)
     {
         db.Entry(exercises).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(exercises);
 }