Exemplo n.º 1
0
        public IActionResult GetByName([FromRoute] string name)
        {
            SmcModelDto savedSmcModelDto = _smcModelService.GetByName(name);

            if (savedSmcModelDto == null)
            {
                return(new NotFoundResult());
            }
            else
            {
                return(new OkObjectResult(savedSmcModelDto));
            }
        }
Exemplo n.º 2
0
        private Smc CreateSmc(SmcDto smc, KeysDto keysDto)
        {
            smc.KeysDto  = keysDto;
            smc.SmcModel = _smcModelService.GetByName(smc.SmcModel.Name);
            var status = _smcForwarderService.ForwardCreation(smc);

            if (!status.IsSuccessStatusCode)
            {
                throw new BadRequestException(JsonConvert
                                              .DeserializeObject <ErrorMessageDto>(status.Content.ReadAsStringAsync().Result).ErrorMessage);
            }
            _smcService.Save(smc);
            return(_smcService.GetExistingSmc(smc.Serial));
        }