Beispiel #1
0
        public ActionResult Create(Workout workout)
        {
            if (ModelState.IsValid)
            {
                db.Workouts.Add(workout);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.trainingId = new SelectList(db.Trainings, "id", "name", workout.trainingId);
            return View(workout);
        }
Beispiel #2
0
 public ActionResult Edit(Workout workout)
 {
     if (ModelState.IsValid)
     {
         db.Entry(workout).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.trainingId = new SelectList(db.Trainings, "id", "name", workout.trainingId);
     return View(workout);
 }