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

            var entity = await service.AddPlaneTypeAsync(mapper.Map <PlaneType>(type));

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