Ejemplo n.º 1
0
        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()));
        }
Ejemplo n.º 2
0
        // 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));
        }