Add an action to retrieve un simple summary with
the total of jumps and the last jump
This commit is contained in:
@@ -22,5 +22,7 @@ namespace skydiveLogs_api.Business.Interface
|
||||
IEnumerable<Statistic> GetStatsForLastMonthByDz();
|
||||
|
||||
IEnumerable<Statistic> GetStatsForLastMonthByJumpType();
|
||||
|
||||
SimpleSummary GetSimpleSummary();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user