forked from ddrilling/AsbCloudServer
33 lines
975 B
C#
33 lines
975 B
C#
using AsbCloudApp.Data;
|
|
using AsbCloudApp.Data.ProcessMaps;
|
|
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
|
|
{
|
|
var actualItems = items
|
|
.Where(item => item.Creation <= moment)
|
|
.Where(item => item.Obsolete is null || item.Obsolete >= moment);
|
|
|
|
return actualItems;
|
|
}
|
|
}
|