// Umbraco.Code.MapAll private void Map(ContentVariantDisplay source, ContentVariantScheduleDisplay target, MapperContext context) { target.CreateDate = source.CreateDate; target.DisplayName = source.DisplayName; target.Language = source.Language; target.Name = source.Name; target.PublishDate = source.PublishDate; target.Segment = source.Segment; target.State = source.State; target.Tabs = source.Tabs; target.UpdateDate = source.UpdateDate; // We'll only try and map the ReleaseDate/ExpireDate if the "old" ContentVariantScheduleDisplay is in the context, otherwise we'll just skip it quietly. _ = context.Items.TryGetValue(nameof(ContentItemDisplayWithSchedule.Variants), out var variants); if (variants is IEnumerable <ContentVariantScheduleDisplay> scheduleDisplays) { ContentVariantScheduleDisplay?item = scheduleDisplays.FirstOrDefault(x => x.Language?.Id == source.Language?.Id && x.Segment == source.Segment); if (item is null) { // If we can't find the old variants display, we'll just not try and map it. return; } target.ReleaseDate = item.ReleaseDate; target.ExpireDate = item.ExpireDate; } }
// Umbraco.Code.MapAll private void Map(ContentVariantScheduleDisplay source, ContentVariantDisplay target, MapperContext context) { target.CreateDate = source.CreateDate; target.DisplayName = source.DisplayName; target.Language = source.Language; target.Name = source.Name; target.PublishDate = source.PublishDate; target.Segment = source.Segment; target.State = source.State; target.Tabs = source.Tabs; target.UpdateDate = source.UpdateDate; }
private void Map(IContent source, ContentVariantScheduleDisplay target, MapperContext context) { Map(source, (ContentVariantDisplay)target, context); target.ReleaseDate = GetScheduledDate(source, ContentScheduleAction.Release, context); target.ExpireDate = GetScheduledDate(source, ContentScheduleAction.Expire, context); }