Add controler actions to return stats for
the current season
This commit is contained in:
@@ -66,6 +66,34 @@ namespace skydiveLogs_api.Controllers
|
||||
return _mapper.Map<IEnumerable<StatisticResp>>(result);
|
||||
}
|
||||
|
||||
[HttpGet("ForLastYear")]
|
||||
[EnableCors]
|
||||
public StatisticForLastYearResp ForLastYear()
|
||||
{
|
||||
var resultByDz = _statsService.GetStatsForLastYearByDz();
|
||||
var resultByJumpType = _statsService.GetStatsForLastYearByJumpType();
|
||||
|
||||
var result = new StatisticForLastYearResp();
|
||||
result.ByDz = _mapper.Map<IEnumerable<StatisticResp>>(resultByDz);
|
||||
result.ByJumpType = _mapper.Map<IEnumerable<StatisticResp>>(resultByJumpType);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[HttpGet("ForLastMonth")]
|
||||
[EnableCors]
|
||||
public StatisticForLastMonthResp ForLastMonth()
|
||||
{
|
||||
var resultByDz = _statsService.GetStatsForLastMonthByDz();
|
||||
var resultByJumpType = _statsService.GetStatsForLastMonthByJumpType();
|
||||
|
||||
var result = new StatisticForLastMonthResp();
|
||||
result.ByDz = _mapper.Map<IEnumerable<StatisticResp>>(resultByDz);
|
||||
result.ByJumpType = _mapper.Map<IEnumerable<StatisticResp>>(resultByJumpType);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#region Private properties
|
||||
private readonly IStatsService _statsService;
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.DataContract
|
||||
{
|
||||
public class StatisticForLastMonthResp
|
||||
{
|
||||
public IEnumerable<StatisticResp> ByDz { get; set; }
|
||||
|
||||
public IEnumerable<StatisticResp> ByJumpType { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace skydiveLogs_api.DataContract
|
||||
{
|
||||
public class StatisticForLastYearResp
|
||||
{
|
||||
public IEnumerable<StatisticResp> ByDz { get; set; }
|
||||
|
||||
public IEnumerable<StatisticResp> ByJumpType { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user