public ActionResult EditExercise(int id)
        {
            var exercise          = exerciseRepository.GetExerciseById(id);
            var exerciseViewModel = new ExerciseViewModel()
            {
                Id                     = exercise.Id,
                Description            = exercise.Description,
                Angle                  = exercise.Angle,
                Duration               = exercise.Duration,
                PatientId              = exercise.PatientId,
                NumberOfRepetitions    = exercise.NumberOfRepetitions,
                AdditionalInformations = exercise.AdditionalInformation
            };

            return(View(exerciseViewModel));
        }
Exemple #2
0
        public IHttpActionResult AddDataToExercise(AndroidRequest request)
        {
            if (request == null)
            {
                return(NotFound());
            }

            var patient  = patientRepository.GetPatientByPesel(request.Pesel);
            var exercise = exerciseRepository.GetExerciseById(request.ExerciseId);

            if (patient == null || exercise == null)
            {
                return(NotFound());
            }

            List <GraphData> test = new List <GraphData>();

            request.Angle.ForEach(p =>
                                  test.Add(new GraphData()
            {
                PatinetId      = patient.Id,
                ExerciseId     = exercise.Id,
                yValue         = p,
                xValue         = request.Date,
                CorrectMeasure = p < 30 && p > 10 ? true : false,
            }));

            graphRepository.AddGraphData(test);
            context.SaveChanges();

            return(Ok());
        }