namespace zero.Api.Extensions;
public static class IMapperProfileExtensions
{
///
/// Map data for a zero entity BasicModel
///
public static void MapBasicData(this IMapperProfile profile, TSource source, TDestination target)
where TSource : ZeroEntity
where TDestination : BasicModel
{
target.Id = source.Id;
target.Name = source.Name;
target.Alias = source.Alias;
target.Key = source.Key;
target.IsActive = source.IsActive;
target.CreatedDate = source.CreatedDate;
target.Flavor = source.Flavor;
}
///
/// Map data for a zero entity DiplayModel
///
public static void MapDisplayData(this IMapperProfile profile, TSource source, TDestination target)
where TSource : ZeroEntity
where TDestination : DisplayModel
{
target.Id = source.Id;
target.Name = source.Name;
target.Alias = source.Alias;
target.Key = source.Key;
target.IsActive = source.IsActive;
target.CreatedDate = source.CreatedDate;
target.Flavor = source.Flavor;
target.Sort = source.Sort;
target.Hash = source.Hash;
target.LastModifiedById = source.LastModifiedById;
target.LastModifiedDate = source.LastModifiedDate;
target.CreatedById = source.CreatedById;
target.LanguageId = source.LanguageId;
}
///
/// Map data for a zero entity SaveModel
///
public static void MapSaveData(this IMapperProfile profile, TSource source, TDestination target)
where TSource : SaveModel
where TDestination : ZeroEntity
{
target.Name = source.Name;
target.Alias = source.Alias;
target.Key = source.Key;
target.Sort = source.Sort;
target.IsActive = source.IsActive;
target.Flavor = source.Flavor;
}
}