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); }
/// <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(); }