/// <summary> /// Gets next question for current session. /// </summary> /// <returns>The question.</returns> public ResponseDTO <QuestionDTO> NextQuestion() { if (CurrentSession == null) { return(ResponseDTO <QuestionDTO> .BadRequest("No active session.")); } if (CurrentSession.RemainingQuestions.Count > 0) { QuestionDTO nextQuestion = CurrentSession.RemainingQuestions.First(); CurrentSession.RemainingQuestions.RemoveAt(0); nextQuestion.ShowedMoment = DateTime.Now; return(ResponseDTO <QuestionDTO> .Ok(nextQuestion)); } return(ResponseDTO <QuestionDTO> .NoContent("There are no more questions for the given session")); }
/// <summary> /// Gets all Questions Sets available. /// </summary> /// <returns>Questions set list.</returns> public ResponseDTO <IEnumerable <QuestionsSetDTO> > GetQuestionsSets() { try { return(_questionsSetService.GetQuestionsSets()); } catch (NoContentException) { return(ResponseDTO <IEnumerable <QuestionsSetDTO> > .NoContent("No questions sets were found.")); } catch (Exception ex) { _logger.Error(ex, "Failed to fetch QuestionsSet list."); return(ResponseDTO <IEnumerable <QuestionsSetDTO> > .InternalError( ErrorMessageHelper.FailedOperation("fetching Questions Sets available"))); } }