private async Task EditAsync() { try { await ButtonSpinner.SpinAsync(async() => { await OrgStructureService.EditPositionAsync(Position); await ToastService.ShowToastAsync("Position updated.", ToastType.Success); await Refresh.InvokeAsync(this); await SynchronizationService.UpdateOrgSructurePositions(ExceptPageId); await ModalDialogService.CloseAsync(); }); } catch (AlreadyExistException ex) { ValidationErrorMessage.DisplayError(nameof(Position.Name), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }
public async Task DeleteAsync() { try { await OrgStructureService.DeletePositionAsync(Position.Id); await Refresh.InvokeAsync(this); await SynchronizationService.UpdateOrgSructurePositions(ExceptPageId); await ToastService.ShowToastAsync("Position removed.", ToastType.Success); await ModalDialogService.CloseAsync(); } catch (Exception ex) { await ModalDialogService.CancelAsync(); Logger.LogError(ex.Message, ex); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); } }