public void AddOrUpdateLatestAuthed(string deviceCode, Guid appEntranceId) { if (string.IsNullOrEmpty(deviceCode)) { throw new ArgumentNullException(nameof(deviceCode)); } if (appEntranceId == Guid.Empty) { throw new ArgumentOutOfRangeException("must not be empty", nameof(appEntranceId)); } if (Devices.ContainsKey(deviceCode)) { var info = Devices[deviceCode]; if (info.AppEntranceAuths.ContainsKey(appEntranceId)) { var auth = info.AppEntranceAuths[appEntranceId]; auth.LatestAuthed = DateTimeOffset.UtcNow; } else { info.AppEntranceAuths[appEntranceId] = AppEntranceAuth.Create(); } } else { Devices[deviceCode] = DeviceBindingInfo.Create(appEntranceId); } }
internal static DeviceBindingInfo Create(Guid appEntranceId) { return(new DeviceBindingInfo { AppEntranceAuths = new Dictionary <Guid, AppEntranceAuth> { [appEntranceId] = AppEntranceAuth.Create() } }); }