Esempio n. 1
0
        private async Task InviteAdminAsync()
        {
            try
            {
                await ButtonSpinner.SpinAsync(async() =>
                {
                    var callBakcUrl = await ApplicationUserService.InviteAdministratorAsync(Invitation.Email, NavigationManager.BaseUri);
                    await EmailSenderService.SendUserInvitationAsync(Invitation.Email, callBakcUrl);
                    await ToastService.ShowToastAsync("Administrator invited.", ToastType.Success);
                    await SynchronizationService.UpdateAdministrators(ExceptPageId);
                    await ModalDialogService.CloseAsync();
                });
            }
            catch (AlreadyExistException ex)
            {
                ValidationErrorMessage.DisplayError(nameof(Invitation.Email), ex.Message);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);

                await ModalDialogService.CancelAsync();
            }
        }
Esempio n. 2
0
        private async Task ResendInviteAsync()
        {
            try
            {
                var callBakcUrl = await ApplicationUserService.GetCallBackUrl(DataTableService.SelectedEntity.Email, NavigationManager.BaseUri);

                await EmailSenderService.SendUserInvitationAsync(DataTableService.SelectedEntity.Email, callBakcUrl);

                await ToastService.ShowToastAsync("Administrator invited.", ToastType.Success);
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
            }
        }
Esempio n. 3
0
 private async Task InviteAdminAsync()
 {
     try
     {
         await ButtonSpinner.SpinAsync(async() =>
         {
             var callBakcUrl = await ApplicationUserService.InviteAdministratorAsync(Invitation.Email, NavigationManager.BaseUri);
             await EmailSenderService.SendUserInvitationAsync(Invitation.Email, callBakcUrl);
             await ToastService.ShowToastAsync("Administrator invited.", ToastType.Success);
             await ModalDialogClose();
         });
     }
     catch (HESException ex) when(ex.Code == HESCode.EmailAlreadyTaken)
     {
         ValidationErrorMessage.DisplayError(nameof(Invitation.Email), ex.Message);
     }
     catch (Exception ex)
     {
         Logger.LogError(ex.Message);
         await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
         await ModalDialogCancel();
     }
 }