示例#1
0
        public static PlaceOfBirth MapPlaceOfBirthFromProto(ProtoPlaceOfBirth placeOfBirth)
        {
            if (placeOfBirth == null)
            {
                return(null);
            }

            Country.List.TryGetValue(placeOfBirth.CountryOfBirth, out var country);
            DateTime.TryParseExact(placeOfBirth.Date, "yyyyMMdd",
                                   CultureInfo.InvariantCulture, DateTimeStyles.None, out var dateOfBirth);
            var proto = new PlaceOfBirth(dateOfBirth, placeOfBirth.CityOfBirth, country);

            return(proto);
        }
示例#2
0
        public static ProtoPlaceOfBirth MapPlaceOfBirthToProto(PlaceOfBirth placeOfBirth)
        {
            if (placeOfBirth == null)
            {
                return(null);
            }

            var proto = new ProtoPlaceOfBirth()
            {
                CityOfBirth    = placeOfBirth.CityOfBirth,
                CountryOfBirth = placeOfBirth.CountryOfBirth.TwoLetterCode,
                Date           = placeOfBirth.DateOfBirth.ToString("yyyyMMdd", CultureInfo.InvariantCulture)
            };

            return(proto);
        }