Esempio n. 1
0
        public async Task <Device> DeviceDelete(Device Device)
        {
            if (Device == null)
            {
                throw new ApplicationException($"Please specify the device to delete.");
            }

            var result = await _deviceDataEntity.Remove(Device);

            if (result == null)
            {
                throw new EntityNotFoundException($"Device with ID={Device.DeviceId} not found", Device.DeviceId);
            }
            Log.Debug($"Device removed - {Serializer.Serialize(result.DeviceId)}");
            return(result);
        }
Esempio n. 2
0
        public async Task <Consumer> ConsumerDelete(Consumer Consumer)
        {
            if (Consumer == null)
            {
                throw new ApplicationException($"Please specify the consumer to delete.");
            }

            var result = await _consumerDataEntity.Remove(Consumer);

            if (result == null)
            {
                throw new EntityNotFoundException($"Consumer with ID={Consumer.ConsumerId} not found", Consumer.ConsumerId);
            }

            Log.Debug($"Consumer removed - {Serializer.Serialize(result.ConsumerId)}");
            return(result);
        }