public async Task <ActionResult> SaveStringAnswer(StringAnswer stringAnswer)
        {
            var questionId = int.Parse(Request.Form["QuestionId"].ToString());

            if (stringAnswer.Id != 0)
            {
                var answer = await _questionnaireService.GetAnswer <StringAnswer>(stringAnswer.Id);

                if (answer != null)
                {
                    answer.AnswerContents = stringAnswer.AnswerContents;
                }

                await _questionnaireService.SaveChangesAsync();
            }
            else
            {
                stringAnswer.Question = await _questionnaireService.GetQuestion(questionId);

                stringAnswer.PlannedInspection =
                    await _questionnaireService.GetPlannedInspection(stringAnswer.PlannedInspection.Id);

                await _questionnaireService.CreateAnswer(stringAnswer);
            }

            return(RedirectToAction("Details", new { id = stringAnswer.PlannedInspection.Id }));
        }
        public async Task GetGenericAnswerTAnswerShouldReturnStringAnswer(int answerId)
        {
            var expected = await _dbMock.Object.Answers.FirstAsync(a => a.Id == answerId);

            var actual = await _questionnaireService.GetAnswer <StringAnswer>(answerId);

            Assert.IsType <StringAnswer>(actual);
            Assert.Equal(expected, actual);
        }
 // GET: Draw/Draw/5
 public async Task <ActionResult> Draw(int id)
 {
     ViewBag.URL = _configurationService["Urls:WebApp"];
     return(View(await _questionnaireService.GetAnswer <FileAnswer>(id)));
 }