public IHttpActionResult Get(int id) { ExerciseService exerciseService = CreateExerciseService(); var exercise = exerciseService.GetExerciseById(id); return(Ok(exercise)); }
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)); }
public ExerciseViewModel GetExerciseById([FromUri] int id) { return(_exerciseService.GetExerciseById(id)); }