public Ringer Map(WrestlerApiModel apiModel)
        {
            Ringer result = new Ringer
            {
                Vorname            = apiModel.Givenname,
                Nachname           = apiModel.Name,
                Status             = apiModel.AuthRating,
                Startausweisnummer = apiModel.PassCode,
                Lizenznummer       = apiModel.LicenceCode?.ToString(),
                Geburtsdatum       = DateTime.Parse(apiModel.Birthday),
                Vereinsnummer      = apiModel.ClubCode,
            };

            switch (apiModel.Gender.ToUpper())
            {
            case "M":
                result.Geschlecht = Geschlecht.Maennlich;
                break;

            case "W":
                result.Geschlecht = Geschlecht.Weiblich;
                break;

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

            return(result);
        }
Exemplo n.º 2
0
        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));
        }