Add MeasurementOwnerId; RevisorId generic attributes to Order; improvements, fixes, etc..

This commit is contained in:
Loretta 2025-10-20 16:46:47 +02:00
parent a0bb6117ae
commit fd39b0700a
2 changed files with 29 additions and 1 deletions

View File

@ -0,0 +1,27 @@
using AyCode.Core.Enums;
using AyCode.Core.Extensions;
using Nop.Core;
namespace Mango.Nop.Core.Extensions;
public static class CollectionExtensionsNopBaseEntity
{
public static void UpdateBaseEntityCollection<TDataItem>(this IList<TDataItem> source, IList<TDataItem> dataItems, bool isRemove) where TDataItem : BaseEntity
{
if (source == null) throw new ArgumentNullException(nameof(source), $"source == null");
if (dataItems == null) throw new ArgumentNullException(nameof(dataItems), $"dataItems == null");
foreach (var dataItem in dataItems)
{
source.UpdateBaseEntityCollection(dataItem, isRemove);
}
}
public static TrackingState UpdateBaseEntityCollection<TDataItem>(this IList<TDataItem> source, TDataItem dataItem, bool isRemove) where TDataItem : BaseEntity
{
if (source == null) throw new ArgumentNullException(nameof(source), $"source == null");
var index = source.FindIndex(x => x.Id == dataItem.Id);
return source.UpdateCollectionByIndex(index, dataItem, isRemove);
}
}

View File

@ -1,8 +1,9 @@
using System.Diagnostics.CodeAnalysis;
using AyCode.Core.Interfaces;
using AyCode.Utils.Extensions;
using LinqToDB.Common;
using Nop.Core;
using Nop.Core.Domain.Common;
using System.Diagnostics.CodeAnalysis;
namespace Mango.Nop.Core.Extensions;