private async Task EditPathAsync(Path path) { try { var result = await PathService.EditPathAsync(path); var item = Paths.FirstOrDefault(x => x.Id == result.Id); if (item != null) { item = result; } SnackbarHelper.PrintSuccess(localizer["PathUpdated"]); } catch (ApiError e) { if (e.ProblemDetails.Status == 422) { SnackbarHelper.PrintErrorDetails((e.ProblemDetails as UnprocessableEntityProblemDetails).Errors); } } catch (Exception e) { SnackbarHelper.PrintError(e.Message); } StateHasChanged(); }
private async Task AddNewPathAsync(Path resultData) { try { var result = await PathService.AddNewPathAsync(resultData); Paths.Add(result); SnackbarHelper.PrintSuccess(localizer["PathCreated"]); } catch (ApiError e) { if (e.ProblemDetails.Status == 422) { SnackbarHelper.PrintErrorDetails((e.ProblemDetails as UnprocessableEntityProblemDetails).Errors); } } catch (Exception e) { SnackbarHelper.PrintError(e.Message); } StateHasChanged(); }