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 <Ringer> Get_Ringer_Async(string startausweisNr) { RingerMapper mapper = new RingerMapper(); JObject response = await _rdbService.Get_CompetitionSystem_Async( "getSaisonWrestler", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("passcode", startausweisNr), }); WrestlerApiModel apiModel = response["wrestler"].ToObject <WrestlerApiModel>(); if (apiModel == null) { throw new ApiNichtGefundenException($"Ringer mit Startausweisnummer {startausweisNr} konnte nicht gefunden werden."); } return(mapper.Map(apiModel)); }
public async Task <List <Kampftag> > Get_Kampftage_Async(string saisonId) { KampftagMapper mapper = new KampftagMapper(); JObject response = await _rdbService.Get_CompetitionSystem_Async( "listOrgBoutday", new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("sid", saisonId), }); IEnumerable <BoutdayApiModel> apiModelListe = response["orgBoutdayList"].Select(elem => elem.FirstOrDefault().ToObject <BoutdayApiModel>()); return(apiModelListe.Select(apiModel => mapper.Map(apiModel)).ToList()); }