public IActionResult Index() { var leagues = _leagueService.GetAll() .OrderByDescending(league => league.LeagueName) .Select(c => new LeagueListingModel { LeagueName = c.LeagueName, LeagueImageUrl = c.LeagueImageUrl, CountryId = c.CountryId }); var model = new LeagueIndexModel { LeagueList = leagues }; return(View(model)); }
public IActionResult CountryLeagues(int id) { var leagues = _leagueService.GetAll() .Where(l => l.CountryId == id) // .OrderBy(league => league.LeagueName) .Select(c => new LeagueListingModel { Id = c.Id, LeagueName = c.LeagueName, LeagueImageUrl = c.LeagueImageUrl, CountryId = c.CountryId }); var model = new LeagueIndexModel { LeagueList = leagues }; return(View(model)); }