Exemplo n.º 1
0
        public SmcAlarmDto Save(SmcAlarmDto t)
        {
            var alarmSmc = _mapper.Map <SmcAlarm>(t);

            alarmSmc.Smc = _smcService.GetExistingSmc(t.Serial);
            _alarmSmcAlarmRepository.Save(alarmSmc);
            return(t);
        }
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));
        }