/// <summary> /// Updates the BasicV2 thing with the content from the BasicInformation property. /// </summary> private async void UpdateThing() { HealthRecordInfo recordInfo = (await _connection.GetPersonInfoAsync()).SelectedRecord; IThingClient thingClient = _connection.CreateThingClient(); List <ThingBase> things = new List <ThingBase>(); things.Add(BasicInformation); await thingClient.UpdateThingsAsync(recordInfo.Id, things); }
private async Task SaveAsync(Medication medication) { UpdateMedication(medication); IThingClient thingClient = _connection.CreateThingClient(); PersonInfo personInfo = await _connection.GetPersonInfoAsync(); await thingClient.UpdateThingsAsync(personInfo.SelectedRecord.Id, new Collection <Medication>() { medication }); await NavigationService.NavigateBackAsync(); }
private async Task SaveProfileAsync() { LoadState = LoadState.Loading; try { // Name property could be null. Construct it if we need to. if (_personalInformation.Name == null && (!string.IsNullOrEmpty(FirstName) || !string.IsNullOrEmpty(LastName))) { _personalInformation.Name = new Name(); } if (_personalInformation.Name != null) { // Only set first and last name if we have it if (!string.IsNullOrEmpty(FirstName)) { _personalInformation.Name.First = FirstName; } if (!string.IsNullOrEmpty(LastName)) { _personalInformation.Name.Last = LastName; } } _basicInformation.BirthYear = BirthDate.Year; _basicInformation.Gender = GenderIndex == 0 ? Gender.Male : Gender.Female; _personalInformation.BirthDate = new HealthServiceDateTime(BirthDate); await _thingClient.UpdateThingsAsync(_recordId, new List <IThing> { _basicInformation, _personalInformation }); await NavigationService.NavigateBackAsync(); } catch (Exception exception) { await DisplayAlertAsync(StringResource.ErrorDialogTitle, exception.ToString()); } finally { LoadState = LoadState.Loaded; } }