protected async Task RegisterNewFormAsync() { NewLoader = "inline"; StateHasChanged(); try { var changeEventValue = await ProtectedSessionStorage.GetAsync <bool>("gradu"); if (changeEventValue) { var UniqueSignatureName = await ProtectedSessionStorage.GetAsync <string>("UniqueSignatureName"); var UniquePhotoName = await ProtectedSessionStorage.GetAsync <string>("UniquePhotoName"); if (!string.IsNullOrEmpty(UniqueSignatureName) && !string.IsNullOrEmpty(UniqueSignatureName)) { var authState = await authenticationStateTask; var user = await UserManager.GetUserAsync(authState.User); //model.UniqueKey = Guid.NewGuid().ToString().GetHashCode().ToString("x"); model.UserId = user.Id; var result = await CenterService.InsertRegistrationFormDataAsync(model); if (result == "success") { await ToastObjRegistration.Show(new ToastModel { Title = "Success!", Content = "You have submitted your registration form successfully.", CssClass = "e-toast-success", Icon = "e-success toast-icons" }); model = new RegistrationViewModel(); NewLoader = "none"; model.Year = DateTime.Now.Year.ToString(); await ProtectedSessionStorage.SetAsync("gradu", true); model.GradutionName = "Graduation"; model.PostGradutionName = "Post Graduation"; await Js.CloseModel("modalConfirmDelete"); } else if (result == "failure") { NewLoader = "none"; await ToastObjRegistration.Show(new ToastModel { Title = "Error!", Content = "You are sending bad request, please try again later!", CssClass = "e-toast-danger", Icon = "e-error toast-icons" }); await Js.CloseModel("modalConfirmDelete"); } else { NewLoader = "none"; await ToastObjRegistration.Show(new ToastModel { Title = "Error!", Content = result, CssClass = "e-toast-danger", Icon = "e-error toast-icons" }); await Js.CloseModel("modalConfirmDelete"); } } else { NewLoader = "none"; await ToastObjRegistration.Show(new ToastModel { Title = "Error!", Content = "Please upload both files then try again!", CssClass = "e-toast-danger", Icon = "e-error toast-icons" }); await Js.CloseModel("modalConfirmDelete"); } } else { NewLoader = "none"; await ToastObjRegistration.Show(new ToastModel { Title = "Error!", Content = "You are not eligible!", CssClass = "e-toast-danger", Icon = "e-error toast-icons" }); await Js.CloseModel("modalConfirmDelete"); } } catch (Exception ex) { NewLoader = "none"; await ToastObjRegistration.Show(new ToastModel { Title = "Error!", Content = ex.Message, CssClass = "e-toast-danger", Icon = "e-error toast-icons" }); await Js.CloseModel("modalConfirmDelete"); } }