using Mapster; using Myshipping.Application.Entity; using Myshipping.Application.Service.BookingOrder.Dto; namespace Myshipping.Application { public class Mapper : IRegister { public void Register(TypeAdapterConfig config) { config.ForType() .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null) .Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty) .Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty); config.ForType() .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null) .Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty) .Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty); config.ForType() .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null); config.ForType() .Map(dest => dest.ETD, src => src.ETD.HasValue ? src.ETD.Value.ToString("yyyy-MM-dd") : null) .Map(dest => dest.CLOSEDOCDATE, src => src.CLOSEDOCDATE.HasValue ? src.CLOSEDOCDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : null) .Map(dest => dest.CLOSINGDATE, src => src.CLOSINGDATE.HasValue ? src.CLOSINGDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : null) .Map(dest => dest.CLOSEVGMDATE, src => src.CLOSEVGMDATE.HasValue ? src.CLOSEVGMDATE.Value.ToString("yyyy-MM-dd HH:mm:ss") : null); config.ForType() .Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty); config.ForType() .Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null) .Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null); } } }