public async override Task GetEntitiesFromServer() { List <Task> tasks = new List <Task>(); Task <List <TeamModel> > entitiesTask = interactor.GetEntities("api/floorball/teams", "Error during getting teams"); tasks.Add(entitiesTask); Task <List <LeagueModel> > leaguesTask = interactor.GetEntities <LeagueModel>("api/floorball/leagues", "Error during getting leagues"); tasks.Add(leaguesTask); /*dTask<List<TeamModel>> teamsTask = interactor.GetEntities<TeamModel>("api/floorball/teams", "Error during getting teams"); * tasks.Add(teamsTask);*/ //Task<Dictionary<int, List<int>>> playersAndTeamsTask = interactor.GetEntityMappings("api/floorball/players/teams", "Error during getting teams for player"); await Task.WhenAll(tasks); var entities = entitiesTask.Result; var leagues = leaguesTask.Result; //var teams = teamsTask.Result; TeamModel prevEntity = null; List <SearchCell> searchList = new List <SearchCell>(); foreach (var entity in entities.OrderByDescending(e => e.LeagueId).ThenBy(e => e.Name)) { if (prevEntity == null || entity.Name != prevEntity.Name) { SearchModel.Add(new List <SearchCell>()); var league = leagues.Single(l => l.Id == entity.LeagueId); Titles.Add(new SearchTitle { MainTitle = league.Name, Subtitle = AppDelegate.SharedAppDelegate.TextManager.GetText(league.Gender) }); } SearchModel.Last().Add(new SearchCell { Id = entity.Id, Title = entity.Name, Subtitle = entity.Coach, RightDetail = entity.Year.Year.ToString() }); prevEntity = entity; } FilteredSearchModel = new List <List <SearchCell> >(SearchModel); FilteredTitles = new List <SearchTitle>(Titles); }
public async override Task GetEntitiesFromServer() { List <Task> tasks = new List <Task>(); Task <List <StadiumModel> > entitiesTask = interactor.GetEntities("api/floorball/stadiums", "Error during getting stadiums"); tasks.Add(entitiesTask); /*Task<List<LeagueModel>> leaguesTask = interactor.GetEntities<LeagueModel>("api/floorball/leagues", "Error during getting leagues"); * tasks.Add(leaguesTask); * * Task<List<TeamModel>> teamsTask = interactor.GetEntities<TeamModel>("api/floorball/teams", "Error during getting teams"); * tasks.Add(teamsTask);*/ //Task<Dictionary<int, List<int>>> playersAndTeamsTask = interactor.GetEntityMappings("api/floorball/players/teams", "Error during getting teams for player"); await Task.WhenAll(tasks); var entities = entitiesTask.Result; /*var leagues = leaguesTask.Result; * var teams = teamsTask.Result;*/ StadiumModel prevEntity = null; List <SearchCell> searchList = new List <SearchCell>(); foreach (var entity in entities.OrderBy(e => e.Name)) { if (prevEntity == null || entity.Name != prevEntity.Name) { SearchModel.Add(new List <SearchCell>()); Titles.Add(new SearchTitle { MainTitle = "", Subtitle = "" }); } SearchModel.Last().Add(new SearchCell { Id = entity.Id, Title = entity.Name, Subtitle = entity.Address, RightDetail = "" }); prevEntity = entity; } FilteredSearchModel = new List <List <SearchCell> >(SearchModel); FilteredTitles = new List <SearchTitle>(Titles); }
public async override Task GetEntitiesFromServer() { List <Task> tasks = new List <Task>(); Task <List <MatchModel> > entitiesTask = interactor.GetEntities("api/floorball/matches", "Error during getting matches"); tasks.Add(entitiesTask); Task <List <LeagueModel> > leaguesTask = interactor.GetEntities <LeagueModel>("api/floorball/leagues", "Error during getting leagues"); tasks.Add(leaguesTask); Task <List <TeamModel> > teamsTask = interactor.GetEntities <TeamModel>("api/floorball/teams", "Error during getting teams"); tasks.Add(teamsTask); await Task.WhenAll(tasks); var entities = entitiesTask.Result; var leagues = leaguesTask.Result; var teams = teamsTask.Result; MatchModel prevEntity = null; List <SearchCell> searchList = new List <SearchCell>(); foreach (var entity in entities.OrderBy(e => e.LeagueId).ThenBy(e => e.Round).ThenBy(e => e.Date)) { if (prevEntity == null || entity.LeagueId != prevEntity.LeagueId) { SearchModel.Add(new List <SearchCell>()); var league = leagues.Single(l => l.Id == entity.LeagueId); Titles.Add(new SearchTitle { MainTitle = league.Name + " - " + TextManager.GetText(league.Class), Subtitle = TextManager.GetText(league.Gender) }); } SearchModel.Last().Add(new SearchCell { Id = entity.Id, Title = teams.Single(t => t.Id == entity.HomeTeamId).Name + " - " + teams.Single(t => t.Id == entity.AwayTeamId).Name, Subtitle = entity.Date.ToString("yyyy-MM-dd hh:mm"), RightDetail = entity.Round.ToString() }); prevEntity = entity; } FilteredSearchModel = new List <List <SearchCell> >(SearchModel); FilteredTitles = new List <SearchTitle>(Titles); }
public async override Task GetEntitiesFromServer() { List <Task> tasks = new List <Task>(); Task <List <RefereeModel> > entitiesTask = interactor.GetEntities("api/floorball/referees", "Error during getting referees"); tasks.Add(entitiesTask); await Task.WhenAll(tasks); var entities = entitiesTask.Result; /*var leagues = leaguesTask.Result; * var teams = teamsTask.Result;*/ RefereeModel prevEntity = null; List <SearchCell> searchList = new List <SearchCell>(); foreach (var entity in entities.OrderBy(e => e.Country).ThenBy(e => e.Name).ThenByDescending(e => e.Number)) { if (prevEntity == null || entity.Country != prevEntity.Country) { SearchModel.Add(new List <SearchCell>()); Titles.Add(new SearchTitle { MainTitle = AppDelegate.SharedAppDelegate.TextManager.GetText(entity.Country), Subtitle = "" }); } SearchModel.Last().Add(new SearchCell { Id = entity.Id, Title = entity.Name, Subtitle = "Match count: " + entity.Number.ToString(), RightDetail = "" }); prevEntity = entity; } FilteredSearchModel = new List <List <SearchCell> >(SearchModel); FilteredTitles = new List <SearchTitle>(Titles); }