Ejemplo n.º 1
0
        public async Task <HttpResponseMessage> Update(NumberValueViewModel entity)
        {
            var errorRes = await ValidateObjectAndCharacteristic(entity.HierarchyObjectId, entity.CharacteristicId, _supportedCharacteristicType);

            if (errorRes != null)
            {
                return(errorRes);
            }
            return(await UpdateInner(entity));
        }
Ejemplo n.º 2
0
        public async Task <HttpResponseMessage> Create([FromUri] Guid objectId, Guid characteristicId, NumberValueViewModel vm)
        {
            var errorRes = await ValidateObjectAndCharacteristic(objectId, characteristicId, _supportedCharacteristicType);

            if (errorRes != null)
            {
                return(errorRes);
            }

            var entity = new NumberCharacteristicValue
            {
                CharacteristicId    = characteristicId,
                HierarchyObjectId   = objectId,
                IsTimeIntervalValue = vm.IsTimeIntervalValue,
                CreationDate        = vm.CreationDate,
                EndCreationDate     = vm.IsTimeIntervalValue ? vm.EndCreationDate : null,
                Value   = vm.Value,
                OwnerId = User.Identity.Name
            };

            return(await CreateInner(objectId, characteristicId, entity));
        }