public static void GetSingleExercise(int id)
        {
            APIRequests request = new APIRequests();

            string url = $"{request.singleExercisesEndpoint}{id}";

            string response = request.GetRequests(url);

            Exercise.ParseWebResponse(response);
        }
Esempio n. 2
0
        /// <summary>
        /// Clears clientDictionaryForDropdown, gets client information from the API
        /// </summary>
        public static void GetClients()
        {
            clientDictionaryForDropdown.Clear();
            clientDictionaryForDropdown.Add("0", "Choose Client");
            APIRequests request = new APIRequests();

            string response = request.GetRequests(request.allClientDetailsEndpoint);

            ParseWebResponse(response);
        }
Esempio n. 3
0
        public static void GetClientTrainingSessions(int clientId)
        {
            APIRequests request = new APIRequests();

            // Use the singleClientDetailEndpoint endpoint, and append {id}/trainingsessions to the URL
            string url = $"{request.singleClientDetailEndpoint}{clientId}/trainingsessions";

            var response = request.GetRequests(url);

            TrainingSession.ParseTrainingSessionData(response);
        }
        /// <summary>
        /// Gets client information from the API
        /// </summary>
        public static void GetWorkoutHistoryForClient(int clientId)
        {
            //clientDictionaryForDropdown.Add("0", "Choose Client");
            APIRequests request = new APIRequests();

            string url = $"{request.singleClientDetailEndpoint}{clientId}/workouthistory";
            //logger.Debug(url);
            string response = request.GetRequests(url);

            ParseWebResponse(response);
        }
        /// <summary>
        /// Gets a list of all exercises in the database
        /// </summary>
        public static void GetExercises()
        {
            exerciseListForDropdown.Clear();

            exerciseListForDropdown.Add("0", "Choose Exercise");
            APIRequests request = new APIRequests();

            string response = request.GetRequests(request.allExercisesEndpoint);

            ParseWebResponse(response);
        }
        /// <summary>
        /// Creates and gets information from the muscle group endpoint.  Then calls ParseWebResponse() to clean them
        /// </summary>
        public static void GetMusclegroups()
        {
            muscleGroupDictionary.Clear();
            muscleGroupList.Clear();
            muscleGroupDictionary.Add("0", "Choose Muscle Group");
            APIRequests request = new APIRequests();

            string response = request.GetRequests(request.allMuscleGroupsEndpoint);

            ParseWebResponse(response);
        }
        /// <summary>
        /// Runs the method to get all training sessions from the API endpoints
        /// </summary>
        public static void GetAllTrainingSessions()
        {
            trainingSessionDictionaryForDropdown.Clear();
            APIRequests request = new APIRequests();

            trainingSessionDictionaryForDropdown.Add("0", "Choose Training Session");

            string response = request.GetRequests(request.allTrainingSessionsEndpoint);

            ParseWebResponseToAddToDictionary(response);
        }
        /// <summary>
        /// Gets information on all exercises assigned to a specific training session
        /// </summary>
        /// <param name="id">ID of the training session you are getting information for</param>
        public static void GetTrainingSessionExercises(int id)
        {
            TrainingSessionExercise.trainingSessionExerciseList.Clear();

            APIRequests request = new APIRequests();

            string url = $"{request.singleTrainingSessionEndpoint}{id}\\exercises";

            string response = request.GetRequests(url);

            ParseTrainingSessionExercises(response);
        }
        /// <summary>
        /// For removing training sessions that were assigned to the client, but have been removed
        /// </summary>
        public static void RemoveTrainingSessionsFromDatabase()
        {
            foreach (var item in AssignedTrainingSessions.removedTrainingSessionList)
            {
                // Handle this differently, so if there is an error a flag will be raised
                //logger.Info($"clientId: {item.clientId}, sessionId: {item.sessionId}");
                APIRequests request = new APIRequests();

                string url = $"{request.singleClientDetailEndpoint}{item.clientId}/trainingsessions/{item.sessionId}";

                var response = request.SendDeleteRequestData(url);

                //logger.Info(response);
            }
        }
        /// <summary>
        /// Adding the new workouts to the database for the user
        /// </summary>
        public static void AddNewTrainingSessionsToDatabase()
        {
            // Change this to check all
            foreach (var item in AssignedTrainingSessions.newTrainingSessionList)
            {
                // Handle this differently, so if there is an error a flag will be raised
                //logger.Info($"clientId: {item.clientId}, sessionId: {item.sessionId}");
                APIRequests request = new APIRequests();

                string url = $"{request.singleClientDetailEndpoint}{item.clientId}/trainingsessions/{item.sessionId}";
                //logger.Info(url);

                var response = request.SendPostRequestData(url);

                //logger.Info(response);
            }
        }