// Once execute it is then actually added to the temporary list of activities
        // This works just like a shopping cart
        public RedirectToActionResult ShowList(int sets, int reps, int weight, string note, int liftId, string liftName, int workoutId, string returnUrl)
        {
            CustomWorkout customWorkout = custom;

            if (customWorkout.WorkoutId == 0)
            {
                customWorkout.WorkoutId = workoutId;
            }
            else if (workoutId != customWorkout.WorkoutId)
            {
                workoutId = customWorkout.WorkoutId;
            }

            Activity activity = new Activity
            {
                Sets      = sets,
                Reps      = reps,
                Weight    = weight,
                Note      = note,
                LiftId    = liftId,
                WorkoutId = workoutId
            };

            customWorkout.AddActivity(activity, liftName);

            return(RedirectToAction("Index", new { returnUrl }));
        }
        public RedirectToActionResult RemoveActivity(int liftId, string returnUrl)
        {
            CustomWorkout customWorkout = custom;

            customWorkout.RemoveActivity(liftId);
            //SaveCustomWorkout(customWorkout);

            return(RedirectToAction("Index", new { returnUrl }));
        }
Exemple #3
0
        public static IWorkout MapCustomWorkout(Workout tpWorkout)
        {
            ICustomWorkout customWorkout = new CustomWorkout();

            customWorkout.TPWorkoutID = tpWorkout.WorkoutId;
            customWorkout.StartDate   = tpWorkout.WorkoutDay;
            customWorkout.StartTime   = tpWorkout.StartTime;
            if (tpWorkout.TimeTotalInSeconds.HasValue)
            {
                customWorkout.Duration = new TimeSpan(0, 0, (int)tpWorkout.TimeTotalInSeconds);
            }
            return(customWorkout);
        }
Exemple #4
0
        public static IWorkout CovertTPWorkoutToInternal(Workout tpWorkout)
        {
            IWorkout internalWorkout;

            switch (tpWorkout.WorkoutTypeDescription)
            {
            case "Swim":
            {
                internalWorkout = MapSwimWorkout(tpWorkout);
                break;
            }

            case "Bike":
            {
                internalWorkout = MapCycleWorkout(tpWorkout);
                break;
            }

            case "Run":
            {
                internalWorkout = MapRunWorkout(tpWorkout);
                break;
            }

            case "Custom":
            {
                internalWorkout = MapCustomWorkout(tpWorkout);
                break;
            }

            default:
            {
                internalWorkout = new CustomWorkout();
                break;
            }
            }
            return(internalWorkout);
        }
 public CustomWorkoutController(IRoutineFitnessRepository repo, UserManager <IdentityUser> userManager, CustomWorkout customWorkout)
 {
     repository       = repo;
     this.userManager = userManager;
     custom           = customWorkout;
 }
 public CustomWorkoutViewComponent(CustomWorkout customWorkoutService)
 {
     customWorkout = customWorkoutService;
 }