예제 #1
0
        public IHttpActionResult Get(int id)
        {
            ExerciseService exerciseService = CreateExerciseService();
            var             exercise        = exerciseService.GetExerciseById(id);

            return(Ok(exercise));
        }
예제 #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));
        }
예제 #3
0
 public ExerciseViewModel GetExerciseById([FromUri] int id)
 {
     return(_exerciseService.GetExerciseById(id));
 }