예제 #1
0
        public async Task SaveFamilyAsync()
        {
            try
            {
                var savable = Model as Csla.Core.ISavable;

                Error  = null;
                IsBusy = true;
                OnSaving(Model);

                var saved = (Family)await savable.SaveAsync();

                var merger = new Csla.Core.GraphMerger();
                merger.MergeBusinessListGraph <Family, Child>(Model, saved);

                IsBusy = false;
                OnSaved();
            }
            catch (Exception ex)
            {
                IsBusy = false;
                Error  = ex;
                OnSaved();
            }
        }
예제 #2
0
        public async Task SaveFamilyAsync()
        {
            var saved = await SaveAsync();

            var merger = new Csla.Core.GraphMerger();

            merger.MergeBusinessListGraph <Family, Child>(Model, saved);
        }
예제 #3
0
        public async Task SaveFamilyAsync()
        {
            try
            {
                var savable = Model as Csla.Core.ISavable;

                Error  = null;
                IsBusy = true;
                OnSaving(Model);

                var saved = (Family)await savable.SaveAsync();

                var merger = new Csla.Core.GraphMerger();
                merger.MergeBusinessListGraph <Family, Child>(Model, saved);

                // reset CurrentChild
                if (CurrentChild != null)
                {
                    foreach (var item in Model)
                    {
                        var itemDetails = item.ChildDetails;
                        var curDetails  = CurrentChild.ChildDetails;
                        if (itemDetails.GivenName == curDetails.GivenName &&
                            itemDetails.FamilyName == curDetails.FamilyName &&
                            itemDetails.Birthday == curDetails.Birthday)
                        {
                            CurrentChild = item;
                            break;
                        }
                    }
                }

                IsBusy = false;
                OnSaved();
            }
            catch (Exception ex)
            {
                IsBusy = false;
                Error  = ex;
                Console.WriteLine("Error while saving family.");
                Console.WriteLine(ex);
                OnSaved();
            }
        }