public ActionResult AddCommentToTicket(int id, TicketComment comment) { if (ModelState.IsValid) { comment.TicketId = id; comment.Date = DateTime.Now; comment.UserId = User.Identity.GetUserId(); TicketHelper.AddCommentToTicket(db, comment); return(RedirectToAction("Detail", new { id })); } return(View(comment)); }
public ActionResult EditComment(int id, TicketComment comment) { if (ModelState.IsValid) { var oldC = db.Comments.Find(id); comment.TicketId = oldC.TicketId; comment.Date = DateTime.Now; comment.UserId = User.Identity.GetUserId(); TicketHelper.DeleteCommentFromTcket(id); TicketHelper.AddCommentToTicket(db, comment); return(RedirectToAction("Detail", new { id = comment.TicketId })); } return(View("AddCommentToTicket", comment)); }