Beispiel #1
0
        public IActionResult PutRoom([FromRoute] Guid guid, [FromBody] OwnedDevice ownedDevice)
        {
            if (guid != ownedDevice.AccountId)
            {
                return(BadRequest());
            }

            return(Ok(ownedDeviceService.Upsert(ownedDevice, User)));
        }
        public OwnedDevice CreateTestOwnedDevice(string testOwnedDeviceName = TestOwnedDeviceName)
        {
            var newOwnedDevice = new OwnedDevice
            {
                DeviceName = testOwnedDeviceName,
                RoomId     = TestRoom.RoomId,
                AccountId  = TestAccount.AccountId
            };

            OwnedDeviceService.Insert(newOwnedDevice);
            newOwnedDevice = OwnedDeviceService.Search(testOwnedDeviceName).First();
            return(newOwnedDevice);
        }
        public void CreateNewOwnedDeviceWithUpsertTest()
        {
            var newOwnedDevice = new OwnedDevice {
                DeviceName = "New Upsert Test Owned Device", AccountId = TestAccount.AccountId, RoomId = TestRoom.RoomId
            };

            OwnedDeviceService.Upsert(newOwnedDevice, TestUserPrincipal);
            var foundOwnedDevices = OwnedDeviceService.Search("New Upsert Test Owned Device").ToList();

            Assert.AreEqual(1, foundOwnedDevices.Count);
            Assert.AreEqual(foundOwnedDevices.First().DeviceName, newOwnedDevice.DeviceName);

            OwnedDeviceService.DeleteByGuid(foundOwnedDevices.First().OwnedDeviceId);
        }
Beispiel #4
0
 public IActionResult PostOwnedDevice([FromBody] OwnedDevice ownedDevice)
 {
     return(Ok(ownedDeviceService.Upsert(ownedDevice, User)));
 }
 public void DeleteTestOwnedDevice(OwnedDevice ownedDevice)
 {
     OwnedDeviceService.DeleteByGuid(ownedDevice.OwnedDeviceId);
 }