예제 #1
0
        public async Task <RedirectResult> OnPost(Guid questionId, Answer answer)
        {
            answer.Creator = new User()
            {
                Id = await _apiClient.GetUserIdAsync(HttpContext.Request.Cookies["user"])
            };

            answer.Id       = new Guid();
            answer.Question = await _apiClient.GetQuestionAsync(answer.Question.Id);

            string token = HttpContext.Request.Cookies["token"].Decrypt();

            await _apiClient.AddAnswerAsync(answer, token);

            return(Redirect($"/Question?id={answer.Question.Id}"));
        }