public async Task <ActionResult> GetSeatTypeByIdAsync(int id) { BlAirplaneSeatType seatTypeBl = await _airplaneService.GetSeatTypeByIdAsync(id); if (seatTypeBl == null) { return(NotFound()); } AirplaneSeatType seatType = _mapper.Map <AirplaneSeatType>(seatTypeBl); return(Ok(seatType)); }
public async Task <ActionResult> AddAirplaneSeatTypeAsync(int airplaneId, [FromBody] AirplaneSeatType seatType) { seatType.AirplaneId = airplaneId; BlAirplaneSeatType seatTypeBl = _mapper.Map <BlAirplaneSeatType>(seatType); AddResult addAddResult = await _airplaneService.AddAirplaneSeatTypeAsync(seatTypeBl); switch (addAddResult.ResultType) { case ResultTypes.Duplicate: return(BadRequest()); case ResultTypes.NotFound: return(NotFound()); } return(Ok(new { Id = addAddResult.ItemId })); }