Esempio n. 1
0
        public async Task <ActionResult <List <TournamentDTO> > > Get([FromQuery] TournamentFilter args)
        {
            var service = new TournamentService(_dbContext);
            List <TournamentDTO> response = await service.GetFilteredTournaments(args);

            return(response);
        }
Esempio n. 2
0
        public ActionResult FilterTournament(TournamentFillterViewModel tournamentFilterVM)
        {
            var filter = new TournamentFilter();

            filter.ConvertToTournametFilter(tournamentFilterVM);

            var result      = _tournamentService.FindTournament(filter);
            var tournaments = Mapper.Map <IEnumerable <Tournament>, IEnumerable <TournamentViewModel> >(result);

            return(PartialView(tournaments));
        }
Esempio n. 3
0
        public ActionResult FilterTournament(TournamentFillterViewModel tournamentFilterVM, int?page)
        {
            var filter = new TournamentFilter();

            filter.ConvertToTournametFilter(tournamentFilterVM);
            ViewBag.CurrentFilter = filter;

            var result      = _tournamentService.FindTournament(filter);
            var tournaments = Mapper.Map <IEnumerable <Tournament>, IEnumerable <TournamentViewModel> >(result);

            int pageSize   = 20;
            int pageNumber = (page ?? 1);

            return(PartialView(tournaments.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 4
0
        public static List <TournamentVO> GetTournamentVOs(TournamentFilter tournamentFilter)
        {
            List <TournamentVO> list           = new List <TournamentVO>();
            IDataController     dataController = Service.Get <IDataController>();

            foreach (TournamentVO current in dataController.GetAll <TournamentVO>())
            {
                if (TournamentController.IsPlanetaryConflict(current))
                {
                    bool flag;
                    switch (tournamentFilter)
                    {
                    case TournamentFilter.Live:
                        flag = TimedEventUtils.IsTimedEventLive(current);
                        break;

                    case TournamentFilter.LiveOrClosing:
                        flag = TimedEventUtils.IsTimedEventLiveOrClosing(current);
                        break;

                    case TournamentFilter.Active:
                        flag = TimedEventUtils.IsTimedEventActive(current);
                        break;

                    case TournamentFilter.All:
                        goto IL_60;

                    default:
                        goto IL_60;
                    }
IL_63:
                    if (flag)
                    {
                        list.Add(current);
                        continue;
                    }
                    continue;
IL_60:
                    flag = true;
                    goto IL_63;
                }
            }
            return(list);
        }
Esempio n. 5
0
        public IEnumerable <Tournament> FindTournament(TournamentFilter filter)
        {
            const string splitOn    = "FederationID";
            var          parameters = new
            {
                Name         = filter.Name,
                StartDate    = filter.StartDate,
                FederationID = filter.FederationID
            };

            using (var objectDb = ObjectDbFactory.CreateInstance("SearchTournament"))
            {
                return(objectDb.Query <Tournament, Federation, Tournament>(
                           (tournament, federation) =>
                {
                    tournament.Federation = federation;
                    return tournament;
                },
                           splitOn,
                           parameters));
            }
        }
Esempio n. 6
0
 public static void ConvertToTournametFilter(this TournamentFilter tournamentFilter, TournamentFillterViewModel tournamentFilterVM)
 {
     tournamentFilter.Name         = tournamentFilterVM.Name;
     tournamentFilter.StartDate    = tournamentFilterVM.StartDate;
     tournamentFilter.FederationID = tournamentFilterVM.FederationID;
 }
        public async Task <PagedTournaments> SearchTournamentAsync(TournamentFilter tournamentFilter)
        {
            IApiResponse <PagedTournaments> apiResponse = await SearchTournamentResponseAsync(tournamentFilter);

            return(apiResponse.Model);
        }
        public async Task <IApiResponse <PagedTournaments> > SearchTournamentResponseAsync(TournamentFilter tournamentFilter)
        {
            Ensure.ArgumentNotNull(tournamentFilter, nameof(tournamentFilter));
            Ensure.AtleastOneCriteriaMustBeDefined(tournamentFilter, nameof(tournamentFilter));

            if (tournamentFilter?.Name != null && tournamentFilter.Name.Length < 3)
            {
                throw new ArgumentException("Name needs to be at least three characters long.", nameof(TournamentFilter.Name));
            }

            if (tournamentFilter?.After != null && tournamentFilter.Before != null)
            {
                throw new InvalidOperationException("Only after or before can be specified for a request, not both.");
            }

            IApiResponse <PagedTournaments> apiResponse = await RestApiClient.GetApiResponseAsync <PagedTournaments>(UrlPathBuilder.TournamentUrl, tournamentFilter.ToQueryParams());

            return(apiResponse);
        }
        public async Task <List <Tournament> > GetOpenTournamentsAsync(TournamentFilter tournamentFilter = null)
        {
            var apiResponse = await GetOpenTournamentsResponseAsync(tournamentFilter);

            return(apiResponse.GetModel());
        }
        public async Task <ApiResponse <List <Tournament> > > GetPopularTournamentsResponseAsync(TournamentFilter tournamentFilter = null)
        {
            var apiResponse = await _restApiClient.GetApiResponseAsync <List <Tournament> >(UrlPathBuilder.PopularTournamentUrl, tournamentFilter?.ToQueryParams());

            return(apiResponse);
        }
Esempio n. 11
0
 public IEnumerable <Tournament> FindTournament(TournamentFilter filter)
 {
     return(_tournamentRepository.FindTournament(filter));
 }
Esempio n. 12
0
        public async Task <TournamentSearchResult> SearchTournamentAsync(TournamentFilter tournamentFilter)
        {
            var apiResponse = await SearchTournamentResponseAsync(tournamentFilter);

            return(apiResponse.GetModel());
        }