This commit is contained in:
@@ -300,7 +300,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// GET
|
// GET
|
||||||
//
|
//
|
||||||
@@ -312,8 +312,8 @@ namespace AyaNova.Biz
|
|||||||
//https://docs.microsoft.com/en-us/ef/core/querying/related-data
|
//https://docs.microsoft.com/en-us/ef/core/querying/related-data
|
||||||
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
||||||
var ret =
|
var ret =
|
||||||
await ct.WorkOrderItem
|
await ct.WorkOrderItem
|
||||||
.Include(wi => wi.WorkorderItemLabors)
|
.Include(wi => wi.WorkorderItemLabors)
|
||||||
.Include(wi => wi.WorkorderItemParts)
|
.Include(wi => wi.WorkorderItemParts)
|
||||||
.SingleOrDefaultAsync(m => m.Id == id);
|
.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
if (logTheGetEvent && ret != null)
|
if (logTheGetEvent && ret != null)
|
||||||
@@ -410,6 +410,23 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// GET
|
||||||
|
//
|
||||||
|
internal async Task<WorkOrderItemLabor> GetLaborAsync(long id, bool logTheGetEvent = true)
|
||||||
|
{
|
||||||
|
//Note: there could be rules checking here in future, i.e. can only get own workorder or something
|
||||||
|
//if so, then need to implement AddError and in route handle Null return with Error check just like PUT route does now
|
||||||
|
|
||||||
|
//https://docs.microsoft.com/en-us/ef/core/querying/related-data
|
||||||
|
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
||||||
|
var ret =
|
||||||
|
await ct.WorkOrderItemLabor
|
||||||
|
.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
|
if (logTheGetEvent && ret != null)
|
||||||
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, AyaType.WorkOrderItemLabor, AyaEvent.Retrieved), ct);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//VALIDATION
|
//VALIDATION
|
||||||
@@ -498,6 +515,24 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// GET
|
||||||
|
//
|
||||||
|
internal async Task<WorkOrderItemPart> GetPartAsync(long id, bool logTheGetEvent = true)
|
||||||
|
{
|
||||||
|
//Note: there could be rules checking here in future, i.e. can only get own workorder or something
|
||||||
|
//if so, then need to implement AddError and in route handle Null return with Error check just like PUT route does now
|
||||||
|
|
||||||
|
//https://docs.microsoft.com/en-us/ef/core/querying/related-data
|
||||||
|
//docs say this will not query twice but will recognize the duplicate woitem bit which is required for multiple grandchild collections
|
||||||
|
var ret =
|
||||||
|
await ct.WorkOrderItemPart
|
||||||
|
.SingleOrDefaultAsync(m => m.Id == id);
|
||||||
|
if (logTheGetEvent && ret != null)
|
||||||
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, id, AyaType.WorkOrderItemPart, AyaEvent.Retrieved), ct);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//VALIDATION
|
//VALIDATION
|
||||||
|
|||||||
Reference in New Issue
Block a user