Exemple #1
0
        public IActionResult AddFlight([FromBody] Flight flight)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest() as IActionResult);
            }
            var entity = service.AddFlight(flight);

            return(entity == null?StatusCode(409) as IActionResult : Created($"{Request.Scheme}://{Request.Host}{Request.Path}{entity.Id}", entity));
        }
        public IActionResult AddFlight([FromBody] Flight flight)
        {
#warning перенести в AIRPORT
            if (!ModelState.IsValid)
            {
                return(BadRequest() as IActionResult);
            }
            var entity = service.AddFlight(flight);
            return(entity == null?StatusCode(409) as IActionResult
                   : Created($"{Request?.Scheme}://{Request?.Host}{Request?.Path}{entity.Id}",
                             mapper.Map <FlightDTO>(entity)));
        }