public async Task <IActionResult> Register(DeviceSelectPageViewModel viewModel) { using (var graph = new GraphRepository(await HttpContext.GetTokenAsync("access_token"))) { var user = await graph.GetUserAsync(); await UserInfoRepository.RegistDeviceIdAsync(user.Id, viewModel.SelectedDeviceId); } return(RedirectToAction("Index")); }
private async Task InvokeAppAsync(string accessToken, string scheme) { try { using (var graph = new GraphRepository(accessToken)) { var user = await graph.GetUserAsync(); var targetDeviceId = await UserInfoRepository.GetTargetDeviceIdByUserIdAsync(user.Id); await graph.AddLaunchAppRequestAsync(targetDeviceId, scheme); } } catch (Exception ex) { Trace.WriteLine(ex); } }