From f2f7265f8a350de3e6f12c4ed478529805da66e0 Mon Sep 17 00:00:00 2001 From: Hadi Khazaee Asl Date: Thu, 18 Dec 2025 19:08:35 +0330 Subject: [PATCH] resolve file referencing on webinar creation time ... --- Providers/XBaseFileProvider.cs | 33 ++++++++++----------------------- Providers/XFileProvider.cs | 10 +++++++++- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Providers/XBaseFileProvider.cs b/Providers/XBaseFileProvider.cs index 1a07f95..ea30bec 100644 --- a/Providers/XBaseFileProvider.cs +++ b/Providers/XBaseFileProvider.cs @@ -192,7 +192,7 @@ namespace xFileService.Providers // // Preparing Index ... int index = GetLastIndex(providedForId); - if (index > 0) + if (index >= 0) { index++; } @@ -627,7 +627,7 @@ namespace xFileService.Providers // var lastIndex = GetLastIndex(providedForId); - if (lastIndex == 0) + if (lastIndex == -1) { // // This Means there isnot any Reference ... @@ -642,29 +642,16 @@ namespace xFileService.Providers else { // - // Check Provided Index Exists or not ... - var isExists = model.References.Any(r => r.Index == forIndex); - if (!isExists) - { - // - // Normalize For Index ... - if (forIndex > lastIndex + 1) - { - forIndex = lastIndex + 1; - } + forIndex = lastIndex + 1; - // - // Add New Reference ... - model.References.Add(new XReference - { - Index = forIndex, - ProvidedFor = Provider, - ReferencedTo = $"{providedForId}" - }); - } - else + // + // Add New Reference ... + model.References.Add(new XReference { - } + Index = forIndex, + ProvidedFor = Provider, + ReferencedTo = $"{providedForId}" + }); } // diff --git a/Providers/XFileProvider.cs b/Providers/XFileProvider.cs index b36cc01..c740a2d 100644 --- a/Providers/XFileProvider.cs +++ b/Providers/XFileProvider.cs @@ -1545,6 +1545,7 @@ namespace xFileService.Providers // // Fill Data for Update ... + var itemEntity = item.FromDto(); entity = entity.UpdateData( updateWith: item, propertyBlackList: new List @@ -1555,7 +1556,14 @@ namespace xFileService.Providers nameof(XFile.References), } ); - entity.References = item.References.ToListString(); + + // + if (!itemEntity.IsNullOrDefault()) + { + entity.References = itemEntity.References; + } + + // if (entity.IsNullOrDefault()) { XException.InvalidData.Throw();