// COMMENTS // GET public PartialViewResult CreateComment(int?id) { TaskCreateCommentVM model = new TaskCreateCommentVM() { TaskID = id.Value }; return(PartialView(model)); }
public ActionResult CreateComment(TaskCreateCommentVM model) { if (!ModelState.IsValid) { return(View(model)); } Comment comment = new Comment() { TaskID = model.TaskID, UserID = AuthenticationManager.LoggedUser.ID, Text = model.Text, CreateDate = DateTime.Now }; CommentService commentService = new CommentService(); commentService.Save(comment); return(RedirectToAction("Details", new { id = model.TaskID })); }