public async Task <Einzelkampf> Get_Einzelkampf_Async(string saisonId, string wettkampfId, int kampfNr) { JObject response = await _rdbService.Get_CompetitionSystem_Async( "getCompetition", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("sid", saisonId), new KeyValuePair <string, string>("cid", wettkampfId), }); JToken[] kaempfeJArray = response["competition"]["_boutList"].ToArray(); if (kaempfeJArray == null || kaempfeJArray.Length <= 0) { throw new ApiNichtGefundenException($"Es sind keine Kämpfe für Saison {saisonId} und Wettkampf {wettkampfId} ({response["competition"]["homeTeamName"]} vs. {response["competition"]["opponentTeamName"]} am {response["competition"]["boutDate"]}) vorhanden."); } JToken kampfJToken = kaempfeJArray.FirstOrDefault(li => li["order"].Value <string>().Equals(kampfNr.ToString())); return(_einzelkampfMapper.Map(kampfJToken)); }
public async Task <List <EinzelkampfSchema> > Get_MannschaftskampfSchema_Async(string saisonId, string wettkampfId) { JObject response = await _rdbService.Get_CompetitionSystem_Async( "getCompetitionScheme", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("sid", saisonId), new KeyValuePair <string, string>("cid", wettkampfId), }); IEnumerable <BoutSchemaApiModel> apiModelListe = response["boutList"].ToObject <IEnumerable <BoutSchemaApiModel> >(); return(apiModelListe.Select(apiModel => _einzelkampfMapper.Map(apiModel)).ToList()); }