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