Source

main-vinayFork / Source / Excel / Excel.AddIn / Excel.AddIn / Extensions / MetadataDetailExtension.cs

Full commit

using DataUp.Excel.BizLogic;

namespace DataUp.Excel.Addin
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public static class MetadataDetailExtension
    {
        public static MetadataDetail SetValuesFrom(this MetadataDetail thisObject, MetadataViewModel metadata)
        {
            if (thisObject == null)
            {
                thisObject = new MetadataDetail();
            }

            thisObject.Name = metadata.Name;
            thisObject.Description = metadata.Description;
            thisObject.IsRequired = metadata.IsRequired;
            thisObject.Type = metadata.Type;
            thisObject.Value = metadata.Value;
            thisObject.FieldType = metadata.FieldType;

            return thisObject;
        }

        public static KeyValue SetKeyValuesFrom(this KeyValue content, MetadataViewModel metadata)
        {
            content.Name = metadata.Name;
            content.Value = metadata.Value;

            return content;
        }
    }
}