resolve file referencing on webinar creation time ...

This commit is contained in:
2025-12-18 19:08:35 +03:30
parent 7b8055fa05
commit f2f7265f8a
2 changed files with 19 additions and 24 deletions
+10 -23
View File
@@ -192,7 +192,7 @@ namespace xFileService.Providers
// //
// Preparing Index ... // Preparing Index ...
int index = GetLastIndex(providedForId); int index = GetLastIndex(providedForId);
if (index > 0) if (index >= 0)
{ {
index++; index++;
} }
@@ -627,7 +627,7 @@ namespace xFileService.Providers
// //
var lastIndex = GetLastIndex(providedForId); var lastIndex = GetLastIndex(providedForId);
if (lastIndex == 0) if (lastIndex == -1)
{ {
// //
// This Means there isnot any Reference ... // This Means there isnot any Reference ...
@@ -642,29 +642,16 @@ namespace xFileService.Providers
else else
{ {
// //
// Check Provided Index Exists or not ... forIndex = lastIndex + 1;
var isExists = model.References.Any(r => r.Index == forIndex);
if (!isExists)
{
//
// Normalize For Index ...
if (forIndex > lastIndex + 1)
{
forIndex = lastIndex + 1;
}
// //
// Add New Reference ... // Add New Reference ...
model.References.Add(new XReference<string> model.References.Add(new XReference<string>
{
Index = forIndex,
ProvidedFor = Provider,
ReferencedTo = $"{providedForId}"
});
}
else
{ {
} Index = forIndex,
ProvidedFor = Provider,
ReferencedTo = $"{providedForId}"
});
} }
// //
+9 -1
View File
@@ -1545,6 +1545,7 @@ namespace xFileService.Providers
// //
// Fill Data for Update ... // Fill Data for Update ...
var itemEntity = item.FromDto();
entity = entity.UpdateData( entity = entity.UpdateData(
updateWith: item, updateWith: item,
propertyBlackList: new List<string> propertyBlackList: new List<string>
@@ -1555,7 +1556,14 @@ namespace xFileService.Providers
nameof(XFile.References), nameof(XFile.References),
} }
); );
entity.References = item.References.ToListString();
//
if (!itemEntity.IsNullOrDefault())
{
entity.References = itemEntity.References;
}
//
if (entity.IsNullOrDefault()) if (entity.IsNullOrDefault())
{ {
XException.InvalidData.Throw(); XException.InvalidData.Throw();