This commit is contained in:
2021-07-26 17:17:19 +00:00
parent e0d6f14156
commit 34cb37a276
35 changed files with 217 additions and 55 deletions

View File

@@ -145,7 +145,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, biz.BizType) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.WorkOrderPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.WorkOrderPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -345,7 +345,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItem) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.ItemPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.ItemPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -452,7 +452,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemExpense) || biz.UserIsSubContractorFull || biz.UserIsSubContractorRestricted)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.ExpensePutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.ExpensePutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -560,7 +560,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemLabor))
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.LaborPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.LaborPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -668,7 +668,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemLoan) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.LoanPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.LoanPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -777,7 +777,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemOutsideService) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.OutsideServicePutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.OutsideServicePutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -884,7 +884,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemPart) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.PartPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.PartPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -990,7 +990,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemPartRequest) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.PartRequestPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.PartRequestPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -1096,7 +1096,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemScheduledUser) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.ScheduledUserPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.ScheduledUserPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -1202,7 +1202,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemTask))
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.TaskPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.TaskPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -1308,7 +1308,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemTravel))
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.TravelPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.TravelPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))
@@ -1414,7 +1414,7 @@ namespace AyaNova.Api.Controllers
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasModifyRole(HttpContext.Items, AyaType.WorkOrderItemUnit) || biz.UserIsRestrictedType)
return StatusCode(403, new ApiNotAuthorizedResponse());
var o = await biz.UnitPutAsync(updatedObject);//In future may need to return entire object, for now just concurrency token
var o = await biz.UnitPutAsync(updatedObject);
if (o == null)
{
if (biz.Errors.Exists(z => z.Code == ApiErrorCode.CONCURRENCY_CONFLICT))