// GET: TicketAttachments
        public ActionResult Index(int ticketId)
        {
            var ticketAttachments = TicketAttachmentHelper.GetTicketAttachments(ticketId);

            ViewBag.TicketId = ticketId;
            return(View(ticketAttachments.ToList()));
        }
        // GET: TicketAttachments/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TicketAttachment ticketAttachment = TicketAttachmentHelper.GetTicketAttachment(id);

            if (ticketAttachment == null)
            {
                return(HttpNotFound());
            }
            return(View(ticketAttachment));
        }
        public ActionResult Create(int ticketId, HttpPostedFileBase file, string description)
        {
            Message message = TicketAttachmentHelper.Create(ticketId, file, description, User.Identity.GetUserId());

            if (message.Code == MessageType.Successful && description.Length > 0)
            {
                return(RedirectToAction("Index", new { ticketId }));
            }
            if (description.Length > 0)
            {
                ViewBag.MessageDescription = "";
            }
            else
            {
                ViewBag.MessageDescription = "Please add the description";
            }
            ViewBag.Message = message.Description;
            return(View());
        }
 public ActionResult DeleteConfirmed(int id, string file, int ticketId)
 {
     TicketAttachmentHelper.Delete(id);
     FileUploaderHelper.Delete(file);
     return(RedirectToAction("Index", new { ticketId }));
 }