public IHttpActionResult GetByHourFilter(FlightFilter filter) { try { var result = DaoFlight.GetByHour(filter); var respuesta = new { errorCode = 0, messageError = "Consulta correcta.", flights = result }; return(Ok(respuesta)); } catch (Exception ex) { CatchError.Log4Net("ERROR", ex); return(BadRequest(ex.Message)); } }
public IHttpActionResult Save(Flight flight) { try { var departureCity = flight.DepartureCity; var arrivalCity = flight.ArrivalCity; DaoFlight.Save(flight); var respuesta = new { errorCode = 0, messageError = $"Se guardo correctamente el vuelo {flight.FlightNumber} de {departureCity.IATACode} a {arrivalCity.IATACode}.", flight = flight }; return(Ok(respuesta)); } catch (Exception ex) { CatchError.Log4Net("ERROR", ex); return(BadRequest(ex.Message)); } }