Esempio n. 1
0
        public async Task <ActionResult> Comment(int id, [FromBody] AnswerRequest comment)
        {
            var user = await _userRepository.GetByEmailAsync(GetUserId());

            if (user.IsBanned)
            {
                return(StatusCode(Microsoft.AspNetCore.Http.StatusCodes.Status406NotAcceptable));
            }


            await _surveyRepository.AddCommentAsync(new SurveyComment
            {
                CreatedAt = DateTime.UtcNow,
                SurveyId  = id,
                Text      = comment.Answer,
                UserId    = user.Id
            });

            return(Ok());
        }