public async Task <IActionResult> AddGoal()
        {
            WeightliftingGoal model = new WeightliftingGoal()
            {
                ID = 0
            };

            return(View("editgoal", model));
        }
        public async Task <IActionResult> EditGoal(EditGoalInputModel GoalInput)
        {
            if (TryValidateModel(GoalInput) == false)
            {
                return(BadRequest());
            }

            FitnessUser currentUser = await GetUser();

            Goal goal = null;

            if (GoalInput.ID != 0)
            {
                goal = await storageService.GetGoalByID(currentUser, GoalInput.ID);
            }
            else
            {
                switch (GoalInput.Type.ToLower())
                {
                case "weightlifting":
                    goal = new WeightliftingGoal();
                    break;

                case "timed":
                    goal = new TimedGoal();
                    break;
                }
            }

            switch (goal)
            {
            case WeightliftingGoal wGoal:
                wGoal.Reps   = GoalInput.Reps;
                wGoal.Weight = GoalInput.Weight;
                break;

            case TimedGoal tGoal:
                tGoal.Quantity     = (int)GoalInput.Quantity;
                tGoal.QuantityUnit = GoalInput.QuantityUnit;
                tGoal.Time         = new TimeSpan(GoalInput.Hours, GoalInput.Minutes, GoalInput.Seconds);
                break;
            }

            goal.Activity = GoalInput.Activity;
            goal.User     = currentUser;

            await storageService.StoreGoal(goal);

            return(RedirectToAction("Summary"));
        }