Esempio n. 1
0
        public ActionResult AddNewWorkoutPlan()
        {
            if (Session["WorkoutSetList"] == null)
            {
                Session["WorkoutSetList"] = new List <WorkoutSet>();
            }
            Strokes_BLL strokes = new Strokes_BLL();

            ViewBag.strokes = strokes.getStrokes();
            return(View());
        }
Esempio n. 2
0
        public ActionResult workoutAction(WorkoutPlan workoutPlan, string WorkoutPlanDate, int Id = -1, string command = "")
        {
            if (Session["strokes"] == null)
            {
                Strokes_BLL strokes = new Strokes_BLL();
                Session["strokes"] = strokes.getStrokes();
            }

            Session["WorkoutPlanDate"] = WorkoutPlanDate;
            List <WorkoutSet> _workoutSets = Session["WorkoutSetList"] as List <WorkoutSet>;

            _workoutSets = workoutPlan.WorkoutSet;
            Session["WorkoutSetList"] = _workoutSets;
            if (command == "Save Plan")
            {
                return(RedirectToAction("SaveWorkoutPlan", "Workout"));
            }
            else if (command == "Create New Set")
            {
                return(RedirectToAction("createSet", "Workout"));
            }
            else if (command == "delete")
            {
                return(RedirectToAction("deleteSet", "Workout", new { index = Id }));
            }
            else if (command == "Print Plan")
            {
                return(RedirectToAction("PrintWorkoutPlan", "Workout", new { planId = Id }));
            }
            else if (command == "Edit Plan")
            {
                return(RedirectToAction("EditWorkoutPlan", "Workout", new { planId = Id }));
            }
            else if (command == "Update Plan")
            {
                return(RedirectToAction("UpdateWorkoutPlan", "Workout"));
            }
            else
            {
                return(View()); //TO-DO: return error message
            }
        }
Esempio n. 3
0
        public ActionResult editSet(FormCollection form)  //Code not relevant now, as now there's a better way to update the model.
        {
            Strokes_BLL strokes    = new Strokes_BLL();
            WorkoutSet  workoutSet = new WorkoutSet();

            workoutSet.Repeats            = int.Parse(form["item.Repeats"]);
            workoutSet.ID                 = int.Parse(form["item.ID"]);
            workoutSet.WorkoutSetDistance = int.Parse(form["item.WorkoutSetDistance"]);
            workoutSet.SingleDuration     = int.Parse(form["item.SingleDuration"]);
            workoutSet.OrderNum           = int.Parse(form["item.OrderNum"]);
            workoutSet.PaceTime           = int.Parse(form["item.PaceTime"]);
            workoutSet.Description        = form["item.Description"];
            workoutSet.Stroke             = strokes.getStrokes(int.Parse(form["strokeSelect"]));

            List <WorkoutSet> _workoutSets = Session["WorkoutSetList"] as List <WorkoutSet>;

            _workoutSets[workoutSet.OrderNum - 1] = workoutSet;

            // _workoutSets.Add(new WorkoutSet(_workoutSets.Count + 1));

            Session["WorkoutSetList"] = _workoutSets;

            return(Json(new { success = true }));
        }