示例#1
0
        public async Task <IActionResult> Add(string questionId,
                                              [FromBodyAttribute] AnswerIgnoreIdAndQuestion answer)
        {
            try
            {
                var question = _quizManager.GetQuestionByIdAsync(questionId);
                if (question == null)
                {
                    return(BadRequest("Question Not found"));
                }

                await _quizManager.AddAnswerAsync(new ResponseData.Answer {
                    QuestionId  = questionId,
                    Description = answer.Description,
                    Notes       = answer.Notes
                });

                return(new StatusCodeResult((int)HttpStatusCode.Created));
            }
            catch (System.Exception ex)
            {
                Console.WriteLine($"[Error ] {ex}");
                return(BadRequest());
            }
        }
示例#2
0
 public Task <IActionResult> Update(string questionId,
                                    [FromBodyAttribute] AnswerIgnoreIdAndQuestion answer)
 {
     throw new NotImplementedException();
 }