public ActionResult PostCommentReply(int id, int ticketCommentId, FormCollection formCollection)
        {
            if (string.IsNullOrEmpty(formCollection["CommentReplyDetails"]))
            {
                TempData["errorMessage"] = "Yikes! Seems like you forgot to provide us with your valuable thoughts in the comments field. How about you try again?";
                return(RedirectToAction("Details", new { id = id }));
            }

            TicketCommentRepository ticketCommentRepository = new TicketCommentRepository();

            TicketComment ticketCommentReply = new TicketComment();

            ticketCommentReply.TicketId = id;
            ticketCommentReply.TicketCommentParentId        = ticketCommentId;
            ticketCommentReply.TicketCommentTimeStamp       = DateTime.UtcNow;
            ticketCommentReply.TicketCommentDetails         = formCollection["CommentReplyDetails"];
            ticketCommentReply.TicketCommentSubmitterUserId = UserHelpers.GetUserId(User.Identity.Name);

            ticketCommentRepository.Add(ticketCommentReply);
            ticketCommentRepository.Save();

            // send out email notifications
            Ticket ticket = ticketRepository.GetTicket(id);

            new EmailNotificationHelpers().TicketCommentEmail(ticket, ticketCommentReply);

            // post the activity
            new ActivityFeedHelpers().ShareTicketCommentReplyFeed(id, ticketCommentId, ticketCommentReply.TicketCommentDetails);

            TempData["message"] = "Your valuable input was successfully posted to ticket #" + id + ". We even went as far as notifiying the appropiate parties!.";
            return(RedirectToAction("Details", new { id = id }));
        }
 public TicketCommentController()
 {
     DbContext               = new ApplicationDbContext();
     TicketRepository        = new TicketRepository(DbContext);
     UserRepository          = new UserRepository(DbContext);
     TicketCommentRepository = new TicketCommentRepository(DbContext);
 }