Exemplo n.º 1
0
        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));
            }
        }
Exemplo n.º 2
0
        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));
            }
        }