Ejemplo n.º 1
0
        public ServiceResponse <int> UpdateDeviceProperty(DevicePropertyDto devicePropertyDto)
        {
            if (devicePropertyDto == null)
            {
                throw new ServiceException(Translate(MessagesConstants.ERR_DATA_NOT_FOUND_TO_SAVE));
            }

            DeviceProperty entity       = new DeviceProperty();
            var            Rm           = new RepositoryManager(ServiceContext);
            int            rowsAffected = Rm.DevicePropertyRepository.Update(entity.CopyFrom(devicePropertyDto));

            if (rowsAffected > 0)
            {
                return(new ServiceResponse <int>(rowsAffected, Translate(MessagesConstants.SCC_DATA_UPDATED)));
            }
            throw new ServiceException(Translate(MessagesConstants.ERR_UPDATE));
        }
Ejemplo n.º 2
0
        public ServiceResponse <long> InsertDeviceProperty(DevicePropertyDto devicePropertyDto)
        {
            if (devicePropertyDto == null)
            {
                throw new ServiceException(Translate(MessagesConstants.ERR_DATA_NOT_FOUND_TO_SAVE));
            }

            DeviceProperty entity = new DeviceProperty();
            var            Rm     = new RepositoryManager(ServiceContext);
            long           id     = Rm.DevicePropertyRepository.Insert(entity.CopyFrom(devicePropertyDto));

            if (id > 0)
            {
                return(new ServiceResponse <long>(id, Translate(MessagesConstants.SCC_DATA_INSERTED)));
            }
            throw new ServiceException(Translate(MessagesConstants.ERR_INSERT));
        }