Exemplo n.º 1
0
        public Device Post(Device device)
        {
            DeviceHelper.GetDeviceInternal(context, device.Id, DeviceHelper.Assertion.NotExist);
            var deviceDal = context.Devices.Add(device)?.Entity;

            context.SaveChanges();
            return(deviceDal);
        }
Exemplo n.º 2
0
        public Device Put(Device device)
        {
            var deviceDal = DeviceHelper.GetDeviceInternal(context, device.Id, DeviceHelper.Assertion.Exist);

            deviceDal.DeviceType      = device.DeviceType;
            deviceDal.IntegrationType = device.IntegrationType;
            context.Devices.Update(deviceDal);
            context.SaveChanges();
            return(deviceDal);
        }