This commit is contained in:
@@ -97,7 +97,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
return BadRequest(new ApiErrorResponse(ModelState));
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
var o = await biz.GetAsync(id);
|
var o = await biz.GetAsync(id, true, true);
|
||||||
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
return Ok(ApiOkResponse.Response(o));
|
return Ok(ApiOkResponse.Response(o));
|
||||||
}
|
}
|
||||||
@@ -125,7 +125,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
else
|
else
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
}
|
}
|
||||||
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency }));;
|
return Ok(ApiOkResponse.Response(new { Concurrency = o.Concurrency })); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
//TODO: allow this but only with ZEROS set for the actual received amount and ignore woitempart requested during dupe?
|
//TODO: allow this but only with ZEROS set for the actual received amount and ignore woitempart requested during dupe?
|
||||||
|
|
||||||
var dbObject = await GetAsync(id, false);
|
var dbObject = await GetAsync(id, false, false);
|
||||||
if (dbObject == null)
|
if (dbObject == null)
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
@@ -102,15 +102,15 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//GET
|
//GET
|
||||||
//
|
//
|
||||||
internal async Task<PurchaseOrder> GetAsync(long id, bool logTheGetEvent = true)
|
internal async Task<PurchaseOrder> GetAsync(long id, bool populateNames, bool logTheGetEvent)
|
||||||
{
|
{
|
||||||
var ret = await ct.PurchaseOrder.Include(z => z.Items).AsNoTracking().SingleOrDefaultAsync(z => z.Id == id);
|
var ret = await ct.PurchaseOrder.Include(z => z.Items).AsNoTracking().SingleOrDefaultAsync(z => z.Id == id);
|
||||||
|
|
||||||
//populate names for client ui
|
//populate names for client ui
|
||||||
var pl= new PickListBiz(ct,UserId,UserTranslationId,CurrentUserRoles);
|
var pl = new PickListBiz(ct, UserId, UserTranslationId, CurrentUserRoles);
|
||||||
var log= AyaNova.Util.ApplicationLogging.CreateLogger("PickListBiz::GetTemplatedNameAsync");
|
var log = AyaNova.Util.ApplicationLogging.CreateLogger("PurchaseOrderBiz::GetAsync");
|
||||||
foreach(PurchaseOrderItem item in ret.Items){
|
foreach (PurchaseOrderItem item in ret.Items)
|
||||||
item.PartName= await pl.GetTemplatedNameAsync(AyaType.Part,item.PartId,null,log);
|
{
|
||||||
|
item.PartName = await pl.GetTemplatedNameAsync(AyaType.Part, item.PartId, null, log);
|
||||||
}
|
}
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, BizType, AyaEvent.Retrieved), ct);
|
||||||
@@ -122,7 +122,7 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
internal async Task<PurchaseOrder> PutAsync(PurchaseOrder putObject)
|
internal async Task<PurchaseOrder> PutAsync(PurchaseOrder putObject)
|
||||||
{
|
{
|
||||||
var dbObject = await GetAsync(putObject.Id, false);
|
var dbObject = await GetAsync(putObject.Id, false, false);
|
||||||
if (dbObject == null)
|
if (dbObject == null)
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.NOT_FOUND, "id");
|
AddError(ApiErrorCode.NOT_FOUND, "id");
|
||||||
@@ -171,7 +171,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var dbObject = await GetAsync(id, false);
|
var dbObject = await GetAsync(id, false, false);
|
||||||
if (dbObject == null)
|
if (dbObject == null)
|
||||||
{
|
{
|
||||||
AddError(ApiErrorCode.NOT_FOUND);
|
AddError(ApiErrorCode.NOT_FOUND);
|
||||||
@@ -216,7 +216,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
public async Task<Search.SearchIndexProcessObjectParameters> GetSearchResultSummary(long id)
|
public async Task<Search.SearchIndexProcessObjectParameters> GetSearchResultSummary(long id)
|
||||||
{
|
{
|
||||||
var obj = await GetAsync(id, false);
|
var obj = await GetAsync(id, false, false);
|
||||||
var SearchParams = new Search.SearchIndexProcessObjectParameters();
|
var SearchParams = new Search.SearchIndexProcessObjectParameters();
|
||||||
DigestSearchText(obj, SearchParams);
|
DigestSearchText(obj, SearchParams);
|
||||||
return SearchParams;
|
return SearchParams;
|
||||||
@@ -553,7 +553,7 @@ namespace AyaNova.Biz
|
|||||||
PurchaseOrder o = null;
|
PurchaseOrder o = null;
|
||||||
//save a fetch if it's a delete
|
//save a fetch if it's a delete
|
||||||
if (job.SubType != JobSubType.Delete)
|
if (job.SubType != JobSubType.Delete)
|
||||||
o = await GetAsync(id, false);
|
o = await GetAsync(id, false, false);
|
||||||
switch (job.SubType)
|
switch (job.SubType)
|
||||||
{
|
{
|
||||||
case JobSubType.TagAddAny:
|
case JobSubType.TagAddAny:
|
||||||
|
|||||||
Reference in New Issue
Block a user