/// <summary> /// Maps the close dialog for the component. /// </summary> /// <param name="result">Dynamic class result in the Modals/DialogResult format.</param> public async void CloseDialog(dynamic result) { if (result != null && !result.IsCancellation) // if the modal is exited from any fashion other then cancel or save then the result will be null { await ItemService.SaveItem(result.Data); string successMessage; if (result.Data.Id != 0) // The dialog was opened for editing so a different message should be sent. { successMessage = string.Format("Item {0}, sucessfully edited!", result.Data.Name); } else { successMessage = string.Format("Item {0}, sucessfully created!", result.Data.Name); } await SweetAlertService.FireAsync(AlertHelper.ToastSuccess(successMessage)); items = await ItemService.GetItems(); StateHasChanged(); } }