コード例 #1
0
        public async override Task <bool> Contains(string command)
        {
            IEnumerable <League> teams = await _leagueRepository.GetAll(version);

            IEnumerable <string> teamNames = teams.Select(p => p.Name);

            return(teamNames.Contains(command));
        }
コード例 #2
0
        public League Create(League league)
        {
            var leages    = _leagueRepository.GetAll().ToList();
            var duplicate = leages.FirstOrDefault(l => l.Name == league.Name);

            if (duplicate != null)
            {
                return(duplicate);
            }
            var id = leages.Count;

            league.Id = id + 1;
            _leagueRepository.Create(league);
            return(league);
        }
コード例 #3
0
        public GetAllLeaguesQueryResult Retrieve(GetAllLeaguesQuery query)
        {
            EnsureArg.IsNotNull(query);
            var leagues = leagueRepository.GetAll();
            var models  = Mapper.Map <IReadOnlyCollection <LeagueModel> >(leagues);

            return(new GetAllLeaguesQueryResult(models));
        }
コード例 #4
0
        public async Task <GrabbElitTournamentView> GetElitTournament()
        {
            int version = await _dataVersionRepository.GetLastVersion();

            IEnumerable <Schedule> schedule = await _scheduleRepository.GetAll(version);

            IEnumerable <League> leagues = await _leagueRepository.GetAll(version);

            GrabbElitTournamentView result = new GrabbElitTournamentView(schedule, leagues);

            return(result);
        }
コード例 #5
0
        public ResponseDto <LeaguesDto> GetAllLeagues()
        {
            var response = new ResponseDto <LeaguesDto>
            {
                Object = new LeaguesDto()
            };

            var leagues = _leagueRepository.GetAll().ToList();

            response.Object.Leagues = _mapper.Map <List <LeagueDto> >(leagues);

            return(response);
        }
コード例 #6
0
        public async Task <GetAllLeaguesResponse> GetAllLeagues()
        {
            IEnumerable <League> leagues = await _leagueRepository.GetAll();

            IEnumerable <LeagueItem> leagueItem = _mapper.Map <IEnumerable <LeagueItem> >(leagues);

            var view = new GetAllLeaguesResponse()
            {
                Leagues = leagueItem
            };

            return(view);
        }
コード例 #7
0
        private async Task <ReplyKeyboardMarkup> GetMenu()
        {
            IEnumerable <League> leagues = await _leagueRepository.GetAll(version);

            var menu = new ReplyKeyboardMarkup();
            List <List <KeyboardButton> > list = new List <List <KeyboardButton> >();

            if (leagues != null)
            {
                List <League> leaguesList  = leagues.ToList();
                int           leaguesCount = leaguesList.Count();
                bool          isEven       = leaguesCount % 2 == 0 ? true : false;

                // TODO: refactor this
                for (int i = 0; i < leaguesCount; i++)
                {
                    List <KeyboardButton> test = new List <KeyboardButton>();
                    if (isEven)
                    {
                        test.Add(new KeyboardButton(leaguesList[i].Name));
                        i++;
                        test.Add(new KeyboardButton(leaguesList[i].Name));
                    }
                    else
                    {
                        test.Add(new KeyboardButton(leaguesList[i].Name));
                        i++;
                        if (i != leaguesCount)
                        {
                            test.Add(new KeyboardButton(leaguesList[i].Name));
                        }
                    }

                    list.Add(test);
                }
            }

            list.Add(new List <KeyboardButton> {
                new KeyboardButton(MessageConstant.DEVELOP)
            });
            menu.Keyboard = list;

            return(menu);
        }
コード例 #8
0
        private async Task <KeyboardMessage> GetLeagues(Callback callback)
        {
            IEnumerable <League> leagues = await _leagueRepository.GetAll(version);

            var keyboardMessage = new KeyboardMessage(callback.Sender.Id, MessageConstant.CHOOSE_LEAGUE)
            {
                Sender = new UserBase
                {
                    Name   = MessageConstant.BOT_NAME,
                    Avatar = MessageConstant.BOT_AVATAR
                },
                Keyboard = new Keyboard
                {
                    DefaultHeight = true,
                    Buttons       = CreateButtons(leagues)
                }
            };

            return(keyboardMessage);
        }
コード例 #9
0
 public async Task <List <League> > GetLeagues()
 {
     return(await _Leagues.GetAll());
 }
コード例 #10
0
 public IEnumerable <LeagueViewModel> GetAll()
 {
     return(mapper.MapDomainToModel(leagueRepository.GetAll()));
 }
コード例 #11
0
 public List <League> GetAll()
 {
     return(_leagueRepo.GetAll());
 }
コード例 #12
0
 public async Task <IEnumerable <LeagueModel> > GetAll()
 {
     return(await leagueRepository.GetAll());
 }