Example #1
0
        public ActionResult CreateComment([Bind(Include = "Content, AuthorId, TopicId")] CreateCommentBindModel model)
        {
            if (this.ModelState.IsValid)
            {
                this.service.AddComment(model);
            }

            return(this.RedirectToAction("ShowTeamTopic", new { topicId = model.TopicId }));
        }
Example #2
0
        public void AddComment(CreateCommentBindModel model)
        {
            var topic = this.topics.GetById(model.TopicId);

            var comment = new Comment()
            {
                Content = model.Content,
                Author  = this.GetCurrentUser(model.AuthorId),
                Topic   = topic
            };

            topic.Comments.Add(comment);
            this.topics.Save();
        }