public ActionResult UpdateFlight([FromBody] FlightModel flightModel) { Flight flight = flightModel.ToEntity(); using (FlightService flightService = new FlightService(_flightManagerDbContext)) { var result = flightService.UpdateFlight(flight); return(new OkObjectResult(result ? ResultStatus.Success : ResultStatus.Failure)); } }
public ActionResult SearchFlights(int skip, int take, [FromBody] FlightModel flightModel) { Flight flight = flightModel.ToEntity(); using (FlightService flightService = new FlightService(_flightManagerDbContext)) { var result = flightService.GetFlights(flight, skip, take); var model = result.Select(f => f.ToModel()); return(new OkObjectResult(model)); } }