Exemplo n.º 1
0
        public async Task <RedirectResult> OnPostAsync(Question question)
        {
            var user = new User()
            {
                Id = await _apiClient.GetUserIdAsync(HttpContext.Request.Cookies["user"])
            };

            question.Creator = user;
            question.Id      = Guid.NewGuid();

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

            await _apiClient.AddQuestionAsync(question, token);

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