public IActionResult Get(Guid id) { var exercise = exercises.Get(id); if (exercise == null) { return(NotFound()); } return(Ok(ExerciseModel.ToModel(exercise))); }
public IActionResult PostExercise(Guid id, [FromBody] ExerciseModel exercise) { var newExercise = homeworks.AddExercise(id, ExerciseModel.ToEntity(exercise)); if (newExercise == null) { return(BadRequest()); } return(CreatedAtRoute("GetExercise", new { id = newExercise.Id }, ExerciseModel.ToModel(newExercise))); }
public IActionResult Get() { return(Ok(ExerciseModel.ToModel(exercises.GetAll()))); }