Exemplo n.º 1
0
        public IActionResult GetNeuralNetwork(Guid id)
        {
            var neuralNetworkFromRepo = _mlpRepository.GetNeuralNetwork(id);

            if (neuralNetworkFromRepo == null)
            {
                return(NotFound());
            }
            var neuralNetwork = Mapper.Map <NeuralNetworkDto>(neuralNetworkFromRepo);

            return(Ok(neuralNetwork));
        }
        public IActionResult CreateImageProcessingConfig([FromBody] ImageProcessingConfigForCreationDto imageProcessingConfig)
        {
            var neuralNetworkFromRepo = _mlpRepository.GetNeuralNetwork(imageProcessingConfig.NeuralNetworkId);

            if (neuralNetworkFromRepo == null)
            {
                return(NotFound("Red no encontrada"));
            }

            var imageProcessingConfigEntity = Mapper.Map <ImageProcessingConfig>(imageProcessingConfig);

            _mlpRepository.AddImageProcessingConfig(imageProcessingConfigEntity);
            if (!_mlpRepository.Save())
            {
                throw new Exception("Creating a Image Processing Config failed on save.");
            }

            var imageProcessingConfigToReturn = Mapper.Map <ImageProcessingConfigDto>(imageProcessingConfigEntity);

            //var links = CreateLinksForNeuralNetwork(neuralNetworkToReturn.Id);
            return(CreatedAtRoute("GetImageProcessingConfig", new { id = imageProcessingConfigToReturn.Id }, imageProcessingConfigToReturn));
        }