Add an endpoint to call the lof of jumps by page.
This commit is contained in:
@@ -5,6 +5,7 @@ using skydiveLogs_api.DataContract;
|
||||
using skydiveLogs_api.Domain;
|
||||
using skydiveLogs_api.DomainBusiness.Interfaces;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace skydiveLogs_api.Controllers
|
||||
{
|
||||
@@ -34,11 +35,32 @@ namespace skydiveLogs_api.Controllers
|
||||
// GET: api/Jump
|
||||
[HttpGet]
|
||||
[EnableCors]
|
||||
public IEnumerable<JumpResp> Get()
|
||||
public JumpListResp Get()
|
||||
{
|
||||
var result = _jumpService.GetAllJumps();
|
||||
var tmp = _jumpService.GetAllJumps();
|
||||
var result = new JumpListResp
|
||||
{
|
||||
Rows = _mapper.Map<IEnumerable<JumpResp>>(tmp),
|
||||
Count = tmp.Count()
|
||||
};
|
||||
|
||||
return _mapper.Map<IEnumerable<JumpResp>>(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
// GET: api/Jump/5/10
|
||||
[HttpGet("{beginJumpIndex}/{endJumpIndex}")]
|
||||
[EnableCors]
|
||||
public JumpListResp Get(int beginJumpIndex, int endJumpIndex)
|
||||
{
|
||||
var totalJumps = _jumpService.GetJumpCount();
|
||||
var tmp = _jumpService.GetJumpsByIndexes(beginJumpIndex, endJumpIndex);
|
||||
var result = new JumpListResp
|
||||
{
|
||||
Rows = _mapper.Map<IEnumerable<JumpResp>>(tmp),
|
||||
Count = totalJumps
|
||||
};
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// GET: api/Jump/5
|
||||
|
||||
Reference in New Issue
Block a user