Add an action to retrieve un simple summary with

the total of jumps and the last jump
This commit is contained in:
Sébastien André
2020-03-03 15:45:36 +01:00
parent e6f0edebf5
commit 6a5e9020d5
7 changed files with 50 additions and 5 deletions

View File

@@ -159,6 +159,20 @@ namespace skydiveLogs_api.Business
.ToList();
}
public SimpleSummary GetSimpleSummary()
{
var allJumps = _jumpRepository.GetAll();
var lastJump = allJumps.OrderByDescending(j => j.JumpDate).FirstOrDefault();
return new SimpleSummary
{
LastJump = lastJump,
TotalJumps = allJumps.Count(),
TotalCutaway = allJumps.Where(j => j.WithCutaway).Count()
};
}
private readonly IJumpRepository _jumpRepository;
}
}