コード例 #1
0
        private async void SaveSection()
        {
            if (!IsValidInput())
            {
                DisplayAlert("Invalid input", "Cannot be empty.");
                return;
            }

            var sectionsRealm    = new Domain.Services.Realms.EvaluationSections();
            var evaluationsRealm = new Domain.Services.Realms.Evaluations();
            await sectionsRealm.WriteAsync(realm =>
            {
                var item        = IsEditingExistingSection ? realm.Get(SectionLocalId) : realm.CreateObject();
                item.Name       = Name;
                item.Body       = Body;
                item.Score      = Score;
                item.Evaluation = evaluationsRealm.Get(EvaluationLocalId);
                item.Synced     = false;
            });

            var synchronizer = new Domain.Services.Sync.Synchronizer();

            synchronizer.SyncPostsAndContinue();

            await LeavePage();
        }