DD.WellWorkover.Cloud/AsbCloudApp/Extensions/ChangeLogExtensions.cs

34 lines
1.0 KiB
C#
Raw Normal View History

using AsbCloudApp.Data;
using AsbCloudApp.Data.ProcessMaps;
2024-02-13 16:35:01 +05:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudApp.Extensions
{
/// <summary>
/// Расширения для поиска в истории
/// </summary>
public static class ChangeLogExtensions
{
/// <summary>
/// Действительные на момент времени значения
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="items"></param>
/// <param name="moment"></param>
/// <returns></returns>
public static IEnumerable<ChangeLogDto<T>> WhereActualAtMoment<T>(this IEnumerable<ChangeLogDto<T>> items, DateTimeOffset moment)
where T : IId
2024-02-13 16:35:01 +05:00
{
var actualItems = items
.Where(item => item.Creation <= moment)
.Where(item => item.Obsolete is null || item.Obsolete >= moment);
2024-02-13 16:35:01 +05:00
return actualItems;
}
}
}