public async Task <JsonResult> GetTicketsByTeamAndType(int?teamId, int?typeId) { if (teamId != null && typeId != null && teamId > 0 && typeId > 0) { User curUser = await userManager.GetCurrentUser(); TicketType curType = await db.TicketTypes.SingleOrDefaultAsync(x => x.Id == typeId); Team curTeam = await db.Teams.SingleOrDefaultAsync(x => x.Id == teamId); if (curTeam != null && curType != null && curUser != null) { if (curTeam.Users.Find(x => x.Id == curUser.Id) != null) { TeamPermissions teamPerms = curTeam.UserPermissions.SingleOrDefault(x => x.User.Id == curUser.Id).TeamRole.Permissions; List <Ticket> ticketsList = await ticketManager.GetTicketsByTeamAndType(teamId, typeId); List <TicketDTO> dtoTicketsList = dtoConverter.ConvertTicketList(ticketsList, curUser, teamPerms); return(Json(dtoTicketsList)); } } } return(Json(false)); }