Пример #1
0
        public async Task <IActionResult> Post([FromBody] DepartureDTO departureDTO)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            try
            {
                await departureService.CreateEntityAsync(departureDTO);
            }
            catch (ValidationException e)
            {
                return(BadRequest(new { Exception = e.Message }));
            }

            return(Ok(departureDTO));
        }