This commit is contained in:
2019-05-20 21:50:19 +00:00
parent 7d9f0e1424
commit 32e9650061
4 changed files with 6 additions and 25 deletions

View File

@@ -59,11 +59,9 @@ namespace AyaNova.Biz
return null;
else
{
//do stuff with datafilter
//do stuff with object
FormCustom outObj = inObj;
outObj.OwnerId = UserId;
await ct.FormCustom.AddAsync(outObj);
await ct.SaveChangesAsync();
@@ -104,10 +102,7 @@ namespace AyaNova.Biz
//put
internal bool Put(FormCustom dbObj, FormCustom inObj)
{
//preserve the owner ID if none was specified
if (inObj.OwnerId == 0)
inObj.OwnerId = dbObj.OwnerId;
//Replace the db object with the PUT object
CopyObject.Copy(inObj, dbObj, "Id");
//Set "original" value of concurrency token to input token
@@ -138,17 +133,6 @@ namespace AyaNova.Biz
private void Validate(FormCustom inObj, bool isNew)
{
//OwnerId required
if (!isNew)
{
if (inObj.OwnerId == 0)
AddError(ApiErrorCode.VALIDATION_REQUIRED, "OwnerId");
}
// //Owner must be current user, there are no exceptions
// if (inObj.OwnerId != UserId)
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "OwnerId", "OwnerId must be current user Id");
//FormKey required and must be valid
if (string.IsNullOrWhiteSpace(inObj.FormKey))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "FormKey");