last ...
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user