Пример #1
0
 public void EnterAndSaveObject(object objectToEnter, RecordEntryFormViewModel viewModel)
 {
     EnterObject(objectToEnter, viewModel);
     if(!viewModel.Validate())
         throw new Exception(viewModel.GetValidationSummary());
     viewModel.SaveButtonViewModel.Invoke();
 }
Пример #2
0
 protected override void ProcessRecordEntryForm(RecordEntryFormViewModel viewModel)
 {
     base.ProcessRecordEntryForm(viewModel);
     foreach (var section in viewModel.FormSectionsAsync)
     {
         if (section is FieldSectionViewModel)
         {
             var fieldSection = (FieldSectionViewModel)section;
             foreach (var field in fieldSection.Fields)
             {
                 PopulateViewModel(field);
             }
         }
     }
     if (!viewModel.Validate())
     {
         throw new ValidationException(string.Format("The Autopopulated Form Did Not Validate:\n{0}", viewModel.GetValidationSummary()));
     }
     if (viewModel.OnSave != null)
     {
         viewModel.OnSave();
     }
 }