示例#1
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));
        }
示例#2
0
        public IActionResult Save(SmcDto smcDto)
        {
            SmcDto savedSmcDto = _smcService.Save(smcDto);

            _eventService.ASmcWasSavedEvent(this, new IoGServicedEventArgs <SmcDto>(savedSmcDto));
            return(new CreatedResult(
                       _servicesUtils
                       .CreateUri(
                           Request,
                           Url.RouteUrl(
                               "GetBySerialSmcRoute",
                               new { serial = savedSmcDto.Serial })),
                       savedSmcDto));
        }