Esempio n. 1
0
        public IHttpActionResult Get(int id)
        {
            ExerciseService exerciseService = CreateExerciseService();
            var             exercise        = exerciseService.GetExerciseById(id);

            return(Ok(exercise));
        }
Esempio n. 2
0
        public async Task <IActionResult> ExercisesGet(
            [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "exercises/{exerciseId}")] HttpRequest req,
            int exerciseId)
        {
            // if the exercise does not exist
            if (!await this.exerciseService.Exists(exerciseId))
            {
                return(new NotFoundObjectResult(new ErrorResponse(ErrorCode.EXERCISE_NOT_FOUND)));
            }

            // get exercise
            ExerciseResponse exercise = await exerciseService.GetExerciseById(exerciseId);

            return(new OkObjectResult(exercise));
        }
Esempio n. 3
0
 public ExerciseViewModel GetExerciseById([FromUri] int id)
 {
     return(_exerciseService.GetExerciseById(id));
 }