Ejemplo n.º 1
0
        public async Task <IActionResult> PostTopic(PostTopicData data)
        {
            var err = new PostTopicData();

            if (data.CheckPostData(err))
            {
                var topic = new Topic()
                {
                    Username = User.Identity.Name,
                    Text     = data.Text,
                    Theme    = data.Theme,
                    Date     = DateTime.Now,
                    Score    = 0
                };
                await _context.AddTopic(topic);

                return(Ok());
            }

            return(BadRequest(err));
        }