Пример #1
0
        public IEnumerable <TournamentDto> GetAll(TournamentResourceParameters tournamentResourceParameters)
        {
            IEnumerable <Tournament> result;

            if (tournamentResourceParameters == null)
            {
                result = tournamentRepository.GetAll();
                return(mapper.Map <IEnumerable <TournamentDto> >(result));
            }
            else
            {
                result = tournamentRepository.GetAll(tournamentResourceParameters);
                return(mapper.Map <IEnumerable <TournamentDto> >(result));
            }
        }
Пример #2
0
        public IEnumerable <Tournament> GetAll(TournamentResourceParameters tournamentResourceParameters)
        {
            var collection = tournamentContext.Tournament as IQueryable <Tournament>;

            if (tournamentResourceParameters == null)
            {
                return(GetAll());
            }
            else if (!string.IsNullOrWhiteSpace(tournamentResourceParameters.SearchQuery))
            {
                var searchQuery = tournamentResourceParameters.SearchQuery.Trim();
                collection = collection
                             .Where(a => a.Name.Contains(searchQuery));
            }
            return(collection.ToList());
        }
 public ActionResult <IEnumerable <TournamentDto> > GetAll([FromQuery] TournamentResourceParameters tournamentResourceParameters)
 {
     //throw new Exception("Test Exception");
     return(Ok(tournamentService.GetAll(tournamentResourceParameters)));
 }