public void DeleteAnswer(Answer answer)
 {
     AnswerRepository.Delete(answer);
     SaveAnswer();
 }
 public void CreateAnswer(Answer answer)
 {
     AnswerRepository.Add(answer);
     SaveAnswer();
 }
 public void UpdateAnswer(Answer answer)
 {
     AnswerRepository.Update(answer);
     SaveAnswer();
 }
        public ActionResult Create(CreateViewModel createViewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(createViewModel);
            }

            var selectedQuestionGroup = QuestionGroupService.FindById(createViewModel.DropDownList_QuestionGroup_Property.SelectedQuestionGroup);

            var answer = new Answer()
            {
                Content = createViewModel.Content,
                QuestionGroup = selectedQuestionGroup,
                QuestionGroupId = createViewModel.DropDownList_QuestionGroup_Property.SelectedQuestionGroup != -1 ? (int?)createViewModel.DropDownList_QuestionGroup_Property.SelectedQuestionGroup : null,
            };

            AnswerService.CreateAnswer(answer);
            TempData["AnswerId"] = answer.AnswerId;
            TempData["AnswerName"] = answer.Content;
            TempData["Message"] = AnswersMessage.CreateSuccess;
            return Redirect(Url.Content("~/feedback/answers/index"));
        }