public static DtoMediaDevice ToDto(this MediaDevice obj) { if (obj == null) { return(null); } DtoMediaDevice result = new DtoMediaDevice { Id = obj.Id, Name = obj.Name, IsPreferred = false }; result.Location = DtoMediaDeviceLocation.Unkown; if (obj.Location != null) { if (obj.Location.Panel == Windows.Devices.Enumeration.Panel.Front) { result.Location = DtoMediaDeviceLocation.Front; } else if (obj.Location.Panel == Windows.Devices.Enumeration.Panel.Back) { result.Location = DtoMediaDeviceLocation.Back; } } return(result); }
public static MediaDevice FromDto(this DtoMediaDevice obj) { if (obj == null) { return(null); } return(new MediaDevice(obj.Id, obj.Name)); }