Ejemplo n.º 1
0
        public async Task <IActionResult> Add(CommentCreatingBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Details", "Events"));
            }

            await this.commentsService.CreateComment(model);

            return(RedirectToAction("Details", "Events"));
        }
Ejemplo n.º 2
0
        public async Task CreateComment(CommentCreatingBindingModel model)
        {
            //TODO Get EventId

            Comment comment = new Comment()
            {
                Content     = model.Content,
                PublishDate = DateTime.Now
            };

            await this.DbContext.Comments.AddAsync(comment);

            await this.DbContext.SaveChangesAsync();
        }