private async void OnSave() { var editingTypeDocument = Mapper.Map <EditableTypeDocument, TypeDocument>(TypeDocument); if (await _typeDocumentsService.HasTitle(editingTypeDocument.TypeDocumentTitle)) { Information?.Invoke("عنوان تکراری می باشد"); } else { try { if (EditMode) { await _typeDocumentsService.UpdateTypeDocumentAsync(editingTypeDocument); } else { await _typeDocumentsService.AddTypeDocumentAsync(editingTypeDocument); } Done?.Invoke(); } catch (Exception ex) { Failed?.Invoke(ex); } finally { TypeDocument = null; } } }
private void OnCancel() { TypeDocument = null; Done?.Invoke(); }
public void SetTypeDocument(TypeDocument typeDocument) { TypeDocument = Mapper.Map <TypeDocument, EditableTypeDocument>(typeDocument); TypeDocument.ErrorsChanged += RaiseCanExecuteChanged; TypeDocument.ValidationDelegate += TypeDocument_ValidationDelegate; }