public async Task <JsonResult> EditSave(int?id, string description, int?type) { if (id != null && description != null && type != null && description != "") { string unescapedText = htmlValidator.ValidateHtml(HttpUtility.UrlDecode(description)); description = unescapedText; Ticket ticket = await ticketManager.GetTicketNoInclude(id); User curUser = await userManager.GetCurrentUser(); TeamPermissions teamPerms = await GetCurrentTeamPermissions(ticket.TeamId, curUser.Id); if (ticket.User.Id == curUser.Id || curUser.AppRole.Permissions.IsAdmin || teamPerms.CanEditTickets) { TicketType newType = await db.TicketTypes.SingleOrDefaultAsync(x => x.Id == type); if (ticket != null && newType != null) { await ticketManager.Edit(id, description, type, curUser); return(Json(true, JsonRequestBehavior.AllowGet)); } } } return(Json(false, JsonRequestBehavior.AllowGet)); }