Updating an editable list

Updating an editable list

Old forum URL: forums.lhotka.net/forums/t/12337.aspx


griff posted on Tuesday, January 28, 2014

Hello

Silverlight, MVVM, csla 4.3.13

Scenario.... two list boxes, buttons in the middle

Left hand list box has names

Right hand list box has 'selected names'

Buttons move  name to selected name (and vice verca).

Using EditableRootList as Model.

Then  linqobservable lists to populate listboxes (based on filter criteria).

The code behind button does this (_SelectedItemsMove is ienumerable binded the SelectedItems of listbox)


private void ExecuteMovePupils(object parameter)
       {
           if (parameter.ToString() == "Move")
           {
               foreach (var moveClassInfo in _SelectedItemsMove)
               {
                   var item = (MoveClassInfo) moveClassInfo; get item
                   var item1 = Model.Item(item.Seq); //get item from Model
                   item1.NextSubGroupID = 13;  //update
               }
           }
           Model.BeginSave(ModelSaved);
 
       }
 
       private void ModelSaved(object sender, Csla.Core.SavedEventArgs e)
       {
           if (e.Error == null && e.NewObject != null)
           {
               Model = (MoveClassList) e.NewObject;
               LoadMoved(12);
               LoadNotMoved(13);
           }
           else
               MessageBoxServiceProvider.ShowError(string.Format("There was an error (details below){0}{1}", System.Environment.NewLine, e.Error.Message), string.Format("Error: in {0} - {1}Completed """"TUCSaved"));
       }

 

Model.BeginSave(ModelSaved) does not appear to fire (do anything)

Am I missing something (or is there a better way to do this process)

Welcome your advice.  Thanks
Richard

 

 

 

 

Copyright (c) Marimer LLC