private async void OnSaveAdd() { var editingGL = Mapper.Map <EditableGL, GL>(GL); try { if (EditMode) { await _gLsService.UpdateGLAsync(editingGL); } else { await _gLsService.AddGLAsync(editingGL); } // Done?.Invoke(); } catch (Exception ex) { Failed(ex); } finally { GL = null; } }
public AddEditGLViewModel(IGLsService gLsService, ISystemAccountingSettingsService systemAccountingSettingsService) { _systemAccountingSettingsService = systemAccountingSettingsService; _gLsService = gLsService; CancelCommand = new RelayCommand(OnCancel); SaveCommand = new RelayCommand(OnSave, CanSave); SaveAddCommand = new RelayCommand(OnSaveAdd, CanSaveAdd); GL = new EditableGL(); }
public void SetGL(GL gL) { GL = Mapper.Map <GL, EditableGL>(gL); GL.ValidationDelegate += GL_ValidationDelegate; GL.ErrorsChanged += RaiseCanExecuteChanged; }