This commit is contained in:
2025-12-21 01:56:12 +03:30
parent 6b111c86b0
commit 3c0fd8200f
+5 -8
View File
@@ -295,19 +295,19 @@ namespace xTagService.Providers
//
// Validate ...
var isValid = !model.IsNullOrDefault() &&
result = !model.IsNullOrDefault() &&
!model.Tag.IsNullOrEmpty() &&
model.Id.IsValidIntId() &&
!providedForId.IsNull();
if (!isValid)
if (!result)
{
XException.InvalidArgs.Throw();
}
//
// Check Model Exists ...
isValid = await TagProvider.IsExists(model.Id);
if (!isValid)
result = await TagProvider.IsExists(model.Id);
if (!result)
{
XException.NotFound.Throw();
}
@@ -333,9 +333,6 @@ namespace xTagService.Providers
//
// Here means there is not any reference to ProvidedForId ...
int forIndex = await CountReferences(providedForId);
//
// Add Reference to Model ...
model.References.Add(new XReference<string>
{
Index = forIndex,
@@ -448,7 +445,7 @@ namespace xTagService.Providers
var reference = model.References
.FirstOrDefault(r => r.ProvidedFor == Provider &&
r.ReferencedTo == $"{providedForId}");
result = !model.IsNullOrDefault();
result = !reference.IsNullOrDefault();
if (!result)
{
XException.ActionFailed.Throw();