Exemplo n.º 1
0
        public HttpResponseMessage GetCorrectAnswerForQuestion(int questionId)
        {
            try
            {
                var answers       = _optionRepo.GetAll();
                var correctAnswer = (from answer in answers
                                     where answer.IsCorrectOption && answer.QuestionId == questionId
                                     select answer).FirstOrDefault();

                return(this.Request.CreateResponse(HttpStatusCode.Accepted, correctAnswer.Text));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message));
            }
        }
Exemplo n.º 2
0
 public IEnumerable <Option> GetAll()
 {
     return(_optionRepository.GetAll());
 }
Exemplo n.º 3
0
        public IActionResult Tab1()
        {
            var optionList = _option.GetAll();

            return(PartialView("_TabPartial1", optionList));
        }