コード例 #1
0
        public void SaveOrUpdate(ControlObjectDTO controlObjectDTO)
        {
            var controlObject = controlObjectDTO.Id > 0
                                    ? _controlObjectRepository.Get(controlObjectDTO.Id)
                                    : new ControlObject();

            controlObject.Name = controlObjectDTO.Name;
            controlObject.Discription = controlObjectDTO.Discription;

            var id=_controlObjectRepository.SaveOrUpdate(controlObject);
            _actionLogService.SetActionLog(controlObjectDTO.Id > 0 ? "редактировал(а) объект контроля " : "создал(а) объект контроля ", id, typeof(ControlObject).Name);
        }
コード例 #2
0
        public ControlObjectDTO GetControlObjectById(int id)
        {
            var controlObject = _controlObjectRepository.Get(id);

            var controlObjectDTO = new ControlObjectDTO
                {
                    Id = controlObject.Id,
                    Name = controlObject.Name,
                    Discription = controlObject.Discription,
                    DataParameters = _dataParameterService.GetDataParameterDTOListByControlObjectId(controlObject.Id),
                    RelayData = _relayDataService.GetRelayDataDTOByControlObjectId(controlObject.Id),
                    Guid = controlObject.Guid,
                    Client = new ClientDTO
                        {
                            Id = controlObject.Client.Id,
                            Name = controlObject.Client.Name,
                            Discription = controlObject.Client.Discription,
                            Guid = controlObject.Client.Guid
                        }
                };
            return controlObjectDTO;
        }