public async Task <IActionResult> Add(CommentCreatingBindingModel model) { if (!ModelState.IsValid) { return(RedirectToAction("Details", "Events")); } await this.commentsService.CreateComment(model); return(RedirectToAction("Details", "Events")); }
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(); }