//*********************************************************************************************************** public void SaveComment(Comment comment) { comment.timestamp = DateTime.Now; this.context.Comments.Add(comment); this.context.SaveChanges(); }
public ActionResult DeleteComment(int id, Comment comment) { try { this.postService.DeleteComment(id); return RedirectToAction("Comments/"+comment.threadId); } catch { return View(); } }
public ActionResult CreateComment(FormCollection collection) { Comment comment = new Comment(); comment.username = HttpContext.User.Identity.Name; comment.comment = Request.Form["Comment.comment"]; comment.threadId = Convert.ToInt32(Request.Form["Comment.threadId"]); try { this.postService.SaveComment(comment); return RedirectToAction("Comments/" + comment.threadId); } catch { return View(); } }