public async Task <IHttpActionResult> GetCandidateExercises() { try { var userContext = await _userContextService.GetCurrentUserAsync(); var models = _exerciseService.GetCandidateExerciseList(userContext.Id); var result = models.OrderBy(exercise => exercise.Name).ToArray(); return(Ok(result)); } catch (Exception) { return(InternalServerError()); } }
public async Task <IHttpActionResult> ValidateTask([FromBody] TaskResult taskResult) { if (!ModelState.IsValid) { BadRequest(ModelState); } var user = await _userContextService.GetCurrentUserAsync(); try { var result = await _taskEvaluationServise.ValidateAsync( taskResult.TaskId, taskResult.Template, taskResult.UsedTipsNumber, user.Id); return(Ok(result)); } catch (TimerOutException) { return(BadRequest("Timer went out.")); } }