public IQueryable <League> GetLeaguesForSeason(int seasonId) { return(from l in leagueRepository.Get() where l.Season.Id == seasonId orderby l.DisplayOrder select l); // ICriteria criteria = Session.CreateCriteria(typeof(League)) // .AddOrder(Order.Asc("DisplayOrder")) // .CreateCriteria("Season") // .Add(Expression.IdEq(seasonId)) // ; // return criteria.List<League>() as List<League>; }
/// <summary> /// Gets a single record matching the specified id. /// </summary> /// <param name="id">The identifier.</param> /// <returns>The matching league</returns> public async Task <LeagueDTO> Get(Guid id) { var result = await this.Handler.Execute(_log, async() => { var repositoryResult = await _leagueRepository.Get(id); if (repositoryResult == null) { throw new RecordNotFoundException("League", id); } return(_leagueMapper.ToDto(repositoryResult)); }); return(result); }