This commit is contained in:
@@ -160,8 +160,8 @@ namespace AyaNova.Api.Controllers
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
PurchaseOrderBiz biz = PurchaseOrderBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
// PurchaseOrderBiz biz = PurchaseOrderBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.PurchaseOrder))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
@@ -172,6 +172,27 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get work order item part request list for vendor specified or any vendor if no vendor specified
|
||||
/// </summary>
|
||||
/// <param name="vendorId">optional vendor id will return matches to Part objects manufacturer, wholesaler or alternative wholesaler</param>
|
||||
/// <returns>PurchaseOrder</returns>
|
||||
[HttpGet("requests-by-vendor/{vendorId}")]
|
||||
public async Task<IActionResult> GetRequestsByVendor([FromRoute] long? vendorId)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
PurchaseOrderBiz biz = PurchaseOrderBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
if (null == vendorId)
|
||||
return Ok(ApiOkResponse.Response(await ct.ViewPartRequestList.ToListAsync()));
|
||||
else
|
||||
return Ok(ApiOkResponse.Response(await ct.ViewPartRequestList.Where(z => z.WholesalerId == vendorId || z.AltWholesalerId == vendorId).ToListAsync()));
|
||||
}
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user