Esempio n. 1
0
        public async Task OnValidSubmit()
        {
            Success = true;
            StateHasChanged();



            if (this.Analytic.Id != Guid.Empty)
            {
                var analytic = new EditAnalyticCommand
                {
                    Id        = this.Analytic.Id,
                    Key       = this.Analytic.Key,
                    Dimension = this.Analytic.Dimension
                };

                bool success = await _microscopeClient.PutAnalyticAsync(analytic.Id, analytic);

                if (success)
                {
                    _snackBar.Add("Analytic updated", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.Analytic));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
            else
            {
                var analytic = new AddAnalyticCommand
                {
                    Key       = this.Analytic.Key,
                    Dimension = this.Analytic.Dimension
                };

                string id = await _microscopeClient.PostAnalyticAsync(analytic);

                if (!string.IsNullOrEmpty(id))
                {
                    this.Analytic.Id = Guid.Parse(id);
                    _snackBar.Add("Analytic added", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.Analytic));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
        }
Esempio n. 2
0
        public async Task OnValidSubmit()
        {
            Success = true;
            StateHasChanged();

            if (this.RemoteConfig.Id != Guid.Empty)
            {
                var remote = new EditRemoteConfigCommand
                {
                    Id        = this.RemoteConfig.Id,
                    Key       = this.RemoteConfig.Key,
                    Dimension = this.RemoteConfig.Dimension
                };

                bool success = await _microscopeClient.PutRemoteConfigAsync(this.RemoteConfig.Id, remote);

                if (success)
                {
                    _snackBar.Add("Remote Config updated", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.RemoteConfig));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
            else
            {
                var remote = new AddRemoteConfigCommand
                {
                    Key       = this.RemoteConfig.Key,
                    Dimension = this.RemoteConfig.Dimension
                };

                string id = await _microscopeClient.PostRemoteConfigAsync(remote);

                if (!string.IsNullOrEmpty(id))
                {
                    this.RemoteConfig.Id = Guid.Parse(id);
                    _snackBar.Add("Remote Config added", Severity.Success);
                    MudDialog.Close(DialogResult.Ok(this.RemoteConfig));
                }
                else
                {
                    _snackBar.Add("Error", Severity.Error);
                    MudDialog.Close(DialogResult.Cancel());
                }
            }
        }
Esempio n. 3
0
        public async Task OnValidSubmit()
        {
            Success = true;
            StateHasChanged();

            var command = new AddContainerCommand {
                Name = this.StorageContainer.Name
            };
            bool success = await _microscopeClient.PostContainerAsync(command);

            if (success)
            {
                _snackBar.Add(localizer["Container Saved"], Severity.Success);
                MudDialog.Close(DialogResult.Ok(this.StorageContainer));
            }
            else
            {
                _snackBar.Add("Error add cotainer", Severity.Error);
                MudDialog.Close(DialogResult.Cancel());
            }
        }