var cem = new TemplateEmailModel
{
To = "idusortus@gmail.com",
Subject = "SES Test"
};
var testCem = new TemplateEmailModel
{
TemplateBody = "",
Content = "Cottage cheese gouda croque monsieur. Cheese triangles cow chalk and cheese pepper jack goat squirty cheese cheese slices cow. Pepper jack swiss chalk and cheese cheese slices pecorino babybel cream cheese rubber cheese. Macaroni cheese everyone loves."
};
cem = MergeObjectsReplaceNulls(cem, testCem);
Stub method
// if customObject has null values, update with defaultObject values
public static T MergeObjectsReplaceNulls<T> (T customObject, T defaultObject)
{
foreach (var property in typeof(T).GetProperties())
{
if (property.GetValue(customObject) == null)
{
property.SetValue(customObject, property.GetValue(defaultObject));
Console.WriteLine($"Prop {property.Name} for object cem was NULL");
Console.WriteLine($">> Set to {property.GetValue(defaultObject)}");
}
else
Console.WriteLine($"property {property.Name} for object cem is NOT NULL");
}
return customObject;
}
Prop TemplateBody for object cem was NULL
>> Set to Blah Blah Blah
property To for object cem is NOT NULL
property Subject for object cem is NOT NULL
property Content for object cem was NULL
>> Set to New Content