public JsonResult UpdateTicket([DataSourceRequest] DataSourceRequest request, TicketAdminViewModel ticket)
        {
            var existingTicket = this.Data.Tickets.GetById(ticket.Id);

            //var xa = ModelState.Keys["PostedOn"];

            if (ModelState.ContainsKey("PostedOn"))
                ModelState["PostedOn"].Errors.Clear();

            if (ticket != null && ModelState.IsValid)
            {
                //var xah = this.Data.Users.All().FirstOrDefault(x => x.UserName == ticket.PostedBy);
                existingTicket.Title = ticket.Title;
                existingTicket.Description = ticket.Description;
                existingTicket.PostedBy = this.Data.Users.All().FirstOrDefault(x => x.UserName == ticket.PostedBy);
                existingTicket.Status = ticket.Status;
                existingTicket.Priority = ticket.Priority;
                //existingTicket.AssignedTo = this.Data.Users.All().FirstOrDefault(x => x.UserName == ticket.AssignedTo);
                ticket.ResolvedOn = existingTicket.ResolvedOn;
                ticket.PostedOn = existingTicket.PostedOn;

                if (!String.IsNullOrEmpty(ticket.AssignedTo))
                {
                    existingTicket.AssignedTo = this.Data.Users.All().FirstOrDefault(x => x.UserName == ticket.AssignedTo);
                }
                else
                {
                    existingTicket.AssignedTo = null;
                }
                this.Data.SaveChanges();
            }

            return Json((new[] { ticket }.ToDataSourceResult(request, ModelState)), JsonRequestBehavior.AllowGet);
        }
        public JsonResult DeleteTicket([DataSourceRequest] DataSourceRequest request, TicketAdminViewModel ticket)
        {
            var existingTicket = this.Data.Tickets.GetById(ticket.Id);

            if (existingTicket != null)
            {
                this.Data.Tickets.Delete(existingTicket.TicketId);
                this.Data.SaveChanges();
            }

            return Json(new[] { ticket }, JsonRequestBehavior.AllowGet);
        }