private void LoadSourceSystemFromService(int sourcesystemId, DateTime validAt)
        {
            this.entityService.ExecuteAsync(
                () => this.entityService.Get<SourceSystem>(sourcesystemId, validAt),
                response =>
                    {
                        // load new entity
                        this.SourceSystem =
                            new SourceSystemViewModel(
                                new EntityWithETag<SourceSystem>(response.Message, response.Tag),
                                this.eventAggregator);

                        // load any mappings
                        this.Mappings =
                            new ObservableCollection<MappingViewModel>(
                                response.Message.Identifiers.Select(
                                    nexusId =>
                                    new MappingViewModel(new EntityWithETag<MdmId>(nexusId, null), this.eventAggregator)));

                        // merge original mappings
                        this.originalMappings.ForEach(x => this.Mappings.Add(x));
                    },
                this.eventAggregator);
        }
 private void Save(SaveEvent saveEvent)
 {
     this.entityService.ExecuteAsync(
         () => this.entityService.Create(this.SourceSystem.Model()),
         () => { this.SourceSystem = new SourceSystemViewModel(this.eventAggregator); },
         string.Format(Message.EntityAddedFormatString, "SourceSystem"),
         this.eventAggregator);
 }
        private void Save(SaveEvent saveEvent)
        {
            this.entityService.ExecuteAsync(
                () => this.entityService.Create(this.SourceSystem.Model()),
                response =>
                    {
                        // clear down view model - this allows us to navigate away
                        var originalId = this.SourceSystem.Id.Value;
                        var originalStartDate = this.SourceSystem.Start;
                        this.SourceSystem = new SourceSystemViewModel(this.eventAggregator);

                        this.navigationService.NavigateMain(
                            new SourceSystemEditCloneUri(
                                response.Message.MdmId().Value,
                                response.Message.MdmSystemData.StartDate.Value,
                                originalId,
                                originalStartDate));
                    },
                this.eventAggregator);
        }
 public void OnNavigatedFrom(NavigationContext navigationContext)
 {
     this.eventAggregator.Unsubscribe<SaveEvent>(this.Save);
     this.eventAggregator.Unsubscribe<EntitySelectedEvent>(this.EntitySelected);
     this.SourceSystem = new SourceSystemViewModel(this.eventAggregator);
 }
        private void LoadSourceSystemFromService(int entityId, DateTime validAt)
        {
            this.entityService.ExecuteAsync(
                () => this.entityService.Get<SourceSystem>(entityId, validAt),
                response =>
                    {
                        this.SourceSystem =
                            new SourceSystemViewModel(
                                new EntityWithETag<SourceSystem>(response.Message, response.Tag),
                                this.eventAggregator);

                        this.RaisePropertyChanged(string.Empty);
                    },
                this.eventAggregator);
        }