我有一个控制器,它返回一个逻辑框架的多个相关实体。其中之一是logicalFrameworkAuditTrails,它记录该逻辑框架的状态。 logicalFrameworkAuditTrails内部的最后一个对象是该逻辑框架的最后状态。现在,我该如何获取最后一个状态ID等于1(logFrameActionStatusReferenceId == 1的日志框)
returned object of the code below here
// GET: api/LogicalFrameworks/LastStatus
[HttpGet("LastStatus/{id}")]
public async Task<IActionResult> GetLogicalFrameworkLastStatus([FromRoute] int id)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
var _logicalFramework = await _context.LogicalFrameworks
.Include(logicalFramework => logicalFramework.Program)
.Include(logicalFramework => logicalFramework.Project)
.Include(logicalFramework => logicalFramework.Office)
.Include(logicalFramework => logicalFramework.FundsSources)
.Include(logicalframework => logicalframework.DesignSummaries)
.ThenInclude(designSummaries => designSummaries.VerifiableIndicators)
.ThenInclude(verifiableIndicators => verifiableIndicators.MeansOfVerifications)
.ThenInclude(meansOfVerifications => meansOfVerifications.Risks)
.Include(logicalFramework => logicalFramework.DesignSummaries)
.ThenInclude(designSummaries => designSummaries.BudgetRequirements)
.Include(logicalframework => logicalframework.DesignSummaries)
.ThenInclude(designSummaries => designSummaries.CCExpenditures)
.Include(logicalframework => logicalframework.DesignSummaries)
.ThenInclude(designSummaries => designSummaries.LogFrameDesignSummaryFundsSources)
.Include(logicalframework => logicalframework.LogicalFrameworkAuditTrails)
.ThenInclude(auditTrails => auditTrails.LogFrameActionStatusReference)
.FirstOrDefaultAsync(x => x.Id == id);
if (_logicalFramework == null)
{
return NotFound();
}
return Ok(_logicalFramework);
}