Exemplo n.º 1
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var token = JToken.ReadFrom(reader);

            return(new Money(
                       _reader.ReadAmount(token, serializer.ContractResolver),
                       _reader.ReadCurrencyCode(token, serializer.ContractResolver)));
        }
Exemplo n.º 2
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            Money?money = default(Money?);
            var   token = JToken.ReadFrom(reader);

            if (token.HasValues)
            {
                money = new Money(
                    _reader.ReadAmount(token, serializer.ContractResolver),
                    _reader.ReadCurrencyCode(token, serializer.ContractResolver));
            }
            return(MoneyReader.AdaptNullables(objectType, money));
        }
Exemplo n.º 3
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var   token = JToken.ReadFrom(reader);
            Money?read  = default(Money?);

            if (token.HasValues)
            {
                read = new Money(
                    _reader.ReadAmount(token, serializer.ContractResolver),
                    _reader.ReadCurrencyCode(token, serializer.ContractResolver));
            }
            return(read);
        }