コード例 #1
0
ファイル: AskController.cs プロジェクト: Orl4ne/AskAppMVC6
        public ActionResult Answering(int id)
        {
            var question       = _askUC.ShowThisQuestion(id);
            var answerQuestion = new AnswerQuestionVM
            {
                Question = question,
            };

            return(View(answerQuestion));
        }
コード例 #2
0
ファイル: AskController.cs プロジェクト: Orl4ne/AskAppMVC6
 public ActionResult Answering(int id, AnswerQuestionVM answerVM)
 {
     try
     {
         var currentUser        = _userManager.GetUserAsync(User).Result;
         var associatedQuestion = _askUC.ShowThisQuestion(id);
         var answerTO           = new AnswerTO
         {
             Message            = answerVM.Answer.Message,
             AssociatedQuestion = associatedQuestion,
             AuthorId           = currentUser.Id,
         };
         _askUC.AnsweringQuestion(id, answerTO);
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }