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<AircraftResp> Get()
|
||||
{
|
||||
return _aircraftService.GetAllAircrafts();
|
||||
var result = _aircraftService.GetAllAircrafts();
|
||||
return _mapper.Map<IEnumerable<AircraftResp>>(result);
|
||||
}
|
||||
|
||||
// GET: api/Aircraft/5
|
||||
[HttpGet("{id}", Name = "Get")]
|
||||
public AircraftResp Get(int id)
|
||||
{
|
||||
return _aircraftService.GetAircraftById(id);
|
||||
var result = _aircraftService.GetAircraftById(id);
|
||||
return _mapper.Map<AircraftResp>(result);
|
||||
}
|
||||
|
||||
// POST: api/Aircraft
|
||||
|
||||
Reference in New Issue
Block a user