public async Task <IActionResult> GetAllAvailablesTrackWithRankings ( [FromQuery(Name = "top")] int?top = null, [FromQuery(Name = "date")] DateTime?date = null ) { bool isUserAdmin = this.IsLoggedUserAdmin(); int? userId = this.GetLoggedUserId(); var trackRankings = (isUserAdmin, userId) switch { (_, null) => await _rankingService.GetAllPublicTracksWithRankingsAsync(top, date), (true, _) => await _rankingService.GetAllTracksWithRankingsForAdminAsync(top, date), (false, _) => await _rankingService.GetAllTracksWithRankingsForUserAsync((int)userId, top, date) }; return(Ok(_mapper.Map <IEnumerable <TrackWithRankingModel> >(trackRankings))); }