Exemplo n.º 1
0
        public async Task <IActionResult> PostAsync([FromBody] SaveDroneResource resource)
        {
            var drone  = _mapper.Map <SaveDroneResource, Drone>(resource);
            var result = await _droneService.CreateAndStartContainer(drone);

            if (!result.Success)
            {
                return(BadRequest(new ErrorResource(result.Message)));
            }

            var dockerContainerResource = _mapper.Map <DockerContainer, DockerContainerResource>(result.Resource);

            return(Ok(dockerContainerResource));
        }