Add AutoMapper config to convert the return data API
This commit is contained in:
@@ -26,14 +26,16 @@ namespace skydiveLogs_api.Controllers
|
||||
[HttpGet]
|
||||
public IEnumerable<JumpResp> Get()
|
||||
{
|
||||
return _jumpService.GetAllJumps();
|
||||
var result = _jumpService.GetAllJumps();
|
||||
return _mapper.Map<IEnumerable<JumpResp>>(result);
|
||||
}
|
||||
|
||||
// GET: api/Jump/5
|
||||
[HttpGet("{id}", Name = "Get")]
|
||||
public JumpResp Get(int id)
|
||||
{
|
||||
return _jumpService.GetJumpById(id);
|
||||
var result = _jumpService.GetJumpById(id);
|
||||
return _mapper.Map<JumpResp>(result);
|
||||
}
|
||||
|
||||
// POST: api/Jump
|
||||
|
||||
Reference in New Issue
Block a user