public Device Post(Device device) { DeviceHelper.GetDeviceInternal(context, device.Id, DeviceHelper.Assertion.NotExist); var deviceDal = context.Devices.Add(device)?.Entity; context.SaveChanges(); return(deviceDal); }
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); }