private void AddQuestion(IQuestion question, IAnswer answer1, IAnswer answer2, IAnswer answer3, IAnswer answer4) { question.AddAnswer(answer1); question.AddAnswer(answer2); question.AddAnswer(answer3); question.AddAnswer(answer4); this.categories.Single(x => x.CategoryType == question.CategoryType).AddQuestion(question); }
public async Task <IActionResult> AddAnswer(QuestionIndexModel model) { var userId = _userManager.GetUserId(User); var user = await _userManager.FindByIdAsync(userId); var answer = BuildReply(model, user); string[] censoredWords = System.IO.File.ReadAllLines(@"CensoredWords.txt"); Censor censor = new Censor(censoredWords); answer.AnswerContent = censor.CensorText(answer.AnswerContent); await _questionImplementation.AddAnswer(answer); await _applicationUserImplementation.UpdateUserRating(userId, typeof(Answer)); return(RedirectToAction("Index", "Question", new { id = model.QuestionId })); }
public void AddAnswer(object answer) { questionType.AddAnswer(answer); }