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)); }
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); }
public GetAllLeaguesQueryResult Retrieve(GetAllLeaguesQuery query) { EnsureArg.IsNotNull(query); var leagues = leagueRepository.GetAll(); var models = Mapper.Map <IReadOnlyCollection <LeagueModel> >(leagues); return(new GetAllLeaguesQueryResult(models)); }
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); }
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); }
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); }
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); }
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); }
public async Task <List <League> > GetLeagues() { return(await _Leagues.GetAll()); }
public IEnumerable <LeagueViewModel> GetAll() { return(mapper.MapDomainToModel(leagueRepository.GetAll())); }
public List <League> GetAll() { return(_leagueRepo.GetAll()); }
public async Task <IEnumerable <LeagueModel> > GetAll() { return(await leagueRepository.GetAll()); }