public Liga Map(LigaApiModel apiModel)
        {
            var result = new Liga
            {
                SaisonId    = apiModel.SaisonId,
                TabellenId  = apiModel.TableId,
                LigaId      = apiModel.LigaId,
                Bezeichnung = $"{apiModel.LigaId}{(!string.IsNullOrEmpty(apiModel.TableId) ? $" {apiModel.TableId}" : string.Empty)} {apiModel.SaisonId}"
            };

            switch (apiModel.Type.ToLower())
            {
            case "utable":
                result.Austragungsmodus = Austragungsmodus.HinRueckRunde;
                break;

            case "wtable":
                result.Austragungsmodus = Austragungsmodus.Doppelrunde;
                break;

            case "amorphous":
                result.Austragungsmodus = Austragungsmodus.KOSystem;
                break;

            case "notable":
                result.Austragungsmodus = Austragungsmodus.NoTable;
                break;

            default:
                throw new ArgumentException($"Austragungsmodus {apiModel.Type} konnte nicht ermittelt werden");
            }

            return(result);
        }
示例#2
0
        public async Task <Tuple <Liga, List <Tabellenplatzierung> > > Get_Liga_mit_Tabellenplatzierungen_Async(string saisonId, string ligaId, string tableId)
        {
            LigaMapper ligaMapper = new LigaMapper();
            TabellenplatzierungMapper tabellenplatzierungMapper = new TabellenplatzierungMapper();

            JObject response = await _rdbService.Get_CompetitionSystem_Async(
                "getTable",
                new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("sid", saisonId),
                new KeyValuePair <string, string>("ligaId", ligaId),
                new KeyValuePair <string, string>("rid", tableId),
            });

            LigaApiModel ligaApiModel = response["table"].ToObject <LigaApiModel>();
            IEnumerable <PlaceApiModel> platzierungApiModelListe = response["table"]["_place"].ToObject <IEnumerable <PlaceApiModel> >();

            return(new Tuple <Liga, List <Tabellenplatzierung> >(ligaMapper.Map(ligaApiModel), tabellenplatzierungMapper.Map(platzierungApiModelListe)));
        }