public async Task <ActionResult> CreateWeight() { IWebHealthVaultConnection webHealthVaultConnection = await WebHealthVaultFactory.CreateWebConnectionAsync(); PersonInfo personInfo = await webHealthVaultConnection.GetPersonInfoAsync(); IThingClient thingClient = webHealthVaultConnection.CreateThingClient(); LocalDateTime nowLocal = SystemClock.Instance.GetCurrentInstant().InZone(DateTimeZoneProviders.Tzdb.GetSystemDefault()).LocalDateTime; await thingClient.CreateNewThingsAsync(personInfo.GetSelfRecord().Id, new List <Weight> { new Weight(new HealthServiceDateTime(nowLocal), new WeightValue(10)) }); return(RedirectToAction("Index", new RouteValueDictionary())); }
// GET: HealthVault public async Task <ActionResult> Index() { IWebHealthVaultConnection webHealthVaultConnection = await WebHealthVaultFactory.CreateWebConnectionAsync(); PersonInfo personInfo = await webHealthVaultConnection.GetPersonInfoAsync(); IThingClient thingClient = webHealthVaultConnection.CreateThingClient(); IReadOnlyCollection <Weight> weights = await thingClient.GetThingsAsync <Weight>(personInfo.GetSelfRecord().Id); return(View(weights)); }