Exemple #1
0
        public static IDictionary <string, object> ToDictionary(this Agent agent, DictionaryWritingTools tools = null)
        {
            var dict = tools?.Dictionary ?? new Dictionary <string, object>();

            if (agent != null)
            {
                dict.Add(tools.BuildPropertyName(nameof(Agent.Name)), agent.Name);
                dict.Add(tools.BuildPropertyName(nameof(Agent.Surname)), agent.Surname);
                dict.Add(tools.BuildPropertyName(nameof(Agent.Phone)), agent.Phone);
            }

            return(dict);
        }
Exemple #2
0
        public static IDictionary <string, object> ToDictionary(this Address address, DictionaryWritingTools tools = null)
        {
            var dict = tools?.Dictionary ?? new Dictionary <string, object>();

            if (address != null)
            {
                dict.Add(tools.BuildPropertyName(nameof(Address.Country)), address.Country);
                dict.Add(tools.BuildPropertyName(nameof(Address.Province)), address.Province);
                dict.Add(tools.BuildPropertyName(nameof(Address.City)), address.City);
                dict.Add(tools.BuildPropertyName(nameof(Address.Zip)), address.Zip);
                dict.Add(tools.BuildPropertyName(nameof(Address.Street)), address.Street);
                dict.Add(tools.BuildPropertyName(nameof(Address.Number)), address.Number);
            }

            return(dict);
        }