This commit is contained in:
@@ -169,6 +169,9 @@ namespace AyaNova.Biz
|
|||||||
//patch
|
//patch
|
||||||
internal bool Patch(Tag dbObj, JsonPatchDocument<Tag> objectPatch, uint concurrencyToken)
|
internal bool Patch(Tag dbObj, JsonPatchDocument<Tag> objectPatch, uint concurrencyToken)
|
||||||
{
|
{
|
||||||
|
//Validate Patch is allowed
|
||||||
|
if (!ValidateJsonPatch<Tag>.Validate(this, objectPatch)) return false;
|
||||||
|
|
||||||
//Do the patching
|
//Do the patching
|
||||||
objectPatch.ApplyTo(dbObj);
|
objectPatch.ApplyTo(dbObj);
|
||||||
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
|
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
|
||||||
|
|||||||
@@ -64,22 +64,16 @@ namespace AyaNova.Biz
|
|||||||
//patch
|
//patch
|
||||||
internal bool Patch(UserOptions dbObj, JsonPatchDocument<UserOptions> objectPatch, uint concurrencyToken)
|
internal bool Patch(UserOptions dbObj, JsonPatchDocument<UserOptions> objectPatch, uint concurrencyToken)
|
||||||
{
|
{
|
||||||
//check for in-valid patches
|
//Validate Patch is allowed
|
||||||
if(objectPatch.Operations.Any(m=>m.path=="Id"))
|
if (!ValidateJsonPatch<UserOptions>.Validate(this, objectPatch)) return false;
|
||||||
{
|
|
||||||
AddError(ValidationErrorType.InvalidOperation,"Id");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Do the patching
|
//Do the patching
|
||||||
objectPatch.ApplyTo(dbObj);
|
objectPatch.ApplyTo(dbObj);
|
||||||
|
|
||||||
|
|
||||||
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
|
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
|
||||||
Validate(dbObj);
|
Validate(dbObj);
|
||||||
if (HasErrors)
|
if (HasErrors)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -154,6 +154,9 @@ namespace AyaNova.Biz
|
|||||||
//patch
|
//patch
|
||||||
internal bool Patch(Widget dbObj, JsonPatchDocument<Widget> objectPatch, uint concurrencyToken)
|
internal bool Patch(Widget dbObj, JsonPatchDocument<Widget> objectPatch, uint concurrencyToken)
|
||||||
{
|
{
|
||||||
|
//Validate Patch is allowed
|
||||||
|
if (!ValidateJsonPatch<Widget>.Validate(this, objectPatch)) return false;
|
||||||
|
|
||||||
//Do the patching
|
//Do the patching
|
||||||
objectPatch.ApplyTo(dbObj);
|
objectPatch.ApplyTo(dbObj);
|
||||||
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
|
ct.Entry(dbObj).OriginalValues["ConcurrencyToken"] = concurrencyToken;
|
||||||
|
|||||||
Reference in New Issue
Block a user