Пример #1
0
        protected override async Task OnInitializedAsync()
        {
            try
            {
                HardwareVaultService = ScopedServices.GetRequiredService <IHardwareVaultService>();

                AccessProfile = await HardwareVaultService.GetProfileByIdAsync(HardwareVaultProfileId);

                if (AccessProfile == null)
                {
                    throw new Exception("Hardware Vault Profile not found.");
                }

                EntityBeingEdited = MemoryCache.TryGetValue(AccessProfile.Id, out object _);
                if (!EntityBeingEdited)
                {
                    MemoryCache.Set(AccessProfile.Id, AccessProfile);
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.Message);
                await ToastService.ShowToastAsync(ex.Message, ToastType.Error);
                await ModalDialogCancel();
            }
        }