Ejemplo n.º 1
0
        public ActionResult Create(CommentCreateViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var comment = new Comment
                {
                    AuthorId = (int)Membership.GetUser().ProviderUserKey,
                    CreationDate = DateTime.Now,
                    Desc = viewModel.Desc,
                    LessonId = viewModel.LessonId,
                };
                commentService.CreateComment(comment);
                return Redirect("/lesson/show/" + viewModel.LessonId);
            }

            return Redirect("/lesson/show/" + viewModel.LessonId);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates comment
 /// </summary>
 /// <param name="comment">The comment to be created</param>
 public void CreateComment(Comment comment)
 {
     this.commentRepo.Add(comment);
     this.commentRepo.Save();
 }