コード例 #1
0
        public async Task <IActionResult> AddStewardess([FromBody] StewardessDTO stewardess)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest() as IActionResult);
            }

            var entity = await service.HireStewardessAsync(mapper.Map <Stewardess>(stewardess));

            return(entity == null?StatusCode(409) as IActionResult
                   : Created($"{Request?.Scheme}://{Request?.Host}{Request?.Path}{entity.Id}",
                             mapper.Map <StewardessDTO>(entity)));
        }