public static DomainDevice ToDomain(this InfrastructureDevice @this) { return(new DomainDevice() { Name = @this.Name, UserId = @this.UserId }); }
public static DomainDevice DeviceToDomain(this InfrastructureDevice @this) { return(new DomainDevice { DeviceID = @this.DeviceID, DeviceName = @this.DeviceName, UserID = @this.UserID }); }
public void DeleteDevice(int deviceId) { InfrastructureDevice device = GetDevice(deviceId); if (device != null) { _context.Remove(device); _context.SaveChanges(); } }
public bool CreateDevice(int userId) { InfrastructureDevice device = new InfrastructureDevice() { DeviceID = devices.Max(_ => _.DeviceID) + 1, DeviceName = "Sensor", UserID = userId }; devices.Add(device); return(true); }
public void CreateDevice(InfrastructureDevice device) { device.Id = _context.Devices.Count() + 1; _context.Devices.Add(device); _context.SaveChanges(); }