public void SubmitForm() { var newDate = new DateTime(Booking2Change.BookingTime.Year, Booking2Change.BookingTime.Month, Booking2Change.BookingTime.Day, Time.Hour, Time.Minute, 0); Booking2Change.BookingTime = newDate; BlazoredModal?.Close(ModalResult.Ok(Booking2Change)); }
public async void Save() { Product.UnitQuantity = NewProductQuantity.UnitQuantityTypeVolume; Product.UnitQuantityType = NewProductQuantity.MeasurementType; //await ProductService.AddProduct(Product); await BlazoredModal.CloseAsync(ModalResult.Ok(Product)); }
public async Task FormSubmitted() { var model = Converter.Convert(View); await Repository.Insert(model); await BlazoredModal.CloseAsync(ModalResult.Ok <TModel>(model)); }
public async Task CreateNewEmployee() { var authState = await authenticationStateTask; int UserId = 0; if (authState.User.Identity.IsAuthenticated) { var User = await UserManager.GetUserAsync(authState.User); UserId = User.Id; } var user = new Employee { FirstName = Input.FirstName, LastName = Input.LastName, Email = Input.Email, PhoneNumber = Input.PhoneNumber, Location = Input.Location, FranchiseeId = UserId, StoreId = Input.StoreId }; IdentityResult result = await UserManager.CreateAsync(user, Input.Password); if (result.Succeeded) { Logger.LogInformation("Franchisee created a new account with password."); await EmailManager.SendConfirmationEmailAsync(user); } await BlazoredModal.Close(ModalResult.Ok(true)); }
public void Save() { var inscriptionController = new BaseController <Inscription>(); if (Inscription.ChildId == null) { StateHasChanged(); } else { Inscription.DayChoose = Inscription.DayChoose.Date.ToUniversalTime(); if (Edit) { inscriptionController.ReplaceOne(Inscription); inscriptionController.UpdateLinkedLists(Inscription); } else { inscriptionController.Insert(Inscription); inscriptionController.UpdateLinkedLists(Inscription); } BlazoredModal.Close(); } }
protected async Task FormSubmitted() { var model = Converter.Convert(View); await repository.Update(Id, model); await BlazoredModal.CloseAsync(ModalResult.Ok <TModel>(model)); }
public async Task AddToDo() { if (CallbackAddToDo.HasDelegate) { await CallbackAddToDo.InvokeAsync(toDo); } await BlazoredModal.Close(); }
protected void Submit() { if (_editContext.Validate()) { UserRepository.Save(MobileSubscription); ToastService.ShowSuccess("Abonnement toegevoegd."); BlazoredModal.Close(ModalResult.Ok <MobileSubscription>(MobileSubscription)); } }
private async void Finish() { await JSRuntime.InvokeVoidAsync("stopScanner"); await BlazoredModal.CloseAsync(ModalResult.Ok(new BarcodeResult { Barcode = BarcodeValue })); }
protected async Task Submit() { var options = new JsonSerializerOptions { Converters = { new HardwareConverter() } }; await HttpClient.PutAsJsonAsync("api/hardware", Command, options); await BlazoredModal.CloseAsync(ModalResult.Ok(Hardware.Id)); }
private async Task HandleSubmit() { var result = await(AuthenticationService as IAuthenticationService).SignIn(LoginModel); IsAuthenticateError = !result; LoginModel = new LoginModel(); if (result) { await BlazoredModal.Close(); } }
private Task SubmitVoteAsync(string vote) { if (string.IsNullOrWhiteSpace(vote)) { return(Task.CompletedTask); } BlazoredModal.Close(ModalResult.Ok(vote, typeof(string))); return(Task.CompletedTask); }
protected async Task SaveOriginAsync() { var isNewOrigin = Origin.OriginId == 0; if (isNewOrigin) { Origin.DateCreated = DateTime.UtcNow; } else { Origin.DateModified = DateTime.UtcNow; } if (!string.IsNullOrEmpty(OriginUri)) { Origin.Uri = new Uri(OriginUri); } Origin.ParentOrigin = SelectedParentOrigin; Origin.CreatedBy ??= UserId; Origin.ModifiedBy = UserId; if (Origin.Location != null) { if (Origin.Location.IsNotEmpty()) { if (Origin.Location.LocationId == 0) { Origin.Location.DateCreated = DateTime.UtcNow; } else { Origin.Location.DateModified = DateTime.UtcNow; } } else { Origin.Location = null; } } Origin = await ApiClient.PutOriginAsync(Origin); if (BlazoredModal != null) { await BlazoredModal.Close(ModalResult.Ok(Origin)); } else { await CancelAsync(isNewOrigin); } }
protected async Task LogIn() { var result = await AccountService.Login(User); if (result.Successful) { BlazoredModal.Close(ModalResult.Ok(true)); } else { ErrorMessage = result.Error; } }
private void ReturnLines(string text) { var lines = text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); var dto = new DTOs.ProxiesForImportDto { Lines = lines, DefaultType = defaultType, DefaultUsername = defaultUsername, DefaultPassword = defaultPassword }; BlazoredModal.Close(ModalResult.Ok(dto)); }
protected async Task SalvarLancamento() { var titulo = isEditing ? "Alteração de Lançamento" : "Inclusão de Lançamento"; var mensagem = isEditing ? "Lançamento alterado com sucesso!!!" : "Lançamento incluído com sucesso!!!"; await AddOrUpdateLancamento(); //await MessageBox(titulo, mensagem, "success", "Ok", string.Empty, false); ShowToast(titulo, mensagem, MatToastType.Success); await BlazoredModal.Close(); await GoToIndex(true); }
protected async Task SalvarEdicao() { var titulo = isEditing ? "Atualização de Afiliado" : "Inclusão de Afiliado"; await AddOrUpdateAfiliado(esteAfiliado); await MessageBox(titulo, "Registro Gravado com Sucesso!!!", "success", "Ok", string.Empty, false); await BlazoredModal.Close(); SetNew(); StateHasChanged(); OpenPage("/afiliadoindex", true); }
public async void HandleValidSubmit() { if (Agency.Id == 0 && await _agencyService.AddAgency(Agency)) { _toastService.ShowSuccess("Agence ajoutée avec succès"); await BlazoredModal.Close(ModalResult.Ok(Agency)); } else if (Agency.Id > 0 && await _agencyService.UpdateAgency(Agency)) { _toastService.ShowSuccess("Agence enregistrée avec succès"); await BlazoredModal.Close(ModalResult.Ok(Agency)); } }
protected void Submit() { if (_item != null) { ParentItem.AddItem(_item); Repository.Save(ParentItem); BlazoredModal.Close(ModalResult.Ok <Item>(_item)); ToastService.ShowSuccess("Item inbegrepen"); } else { ToastService.ShowWarning("Selecteer een item."); } }
protected async Task HandleValidSubmit() { var response = await AirportDataService.AddAirport(Airport); if (response != null) { await BlazoredModal.Close(); ToastService.ShowSuccess($"New Airport {response.ICAO} was created"); } //await CloseEventCallback.InvokeAsync(true); StateHasChanged(); }
protected async Task CreateAccount() { ShowErrors = false; var result = await AccountService.Register(User); if (result.Successful) { BlazoredModal.Close(); } else { Errors = result.Errors; ShowErrors = true; } }
protected async Task CreateTable() { ShowErrors = false; var result = await TableService.Create(PokerTable); if (result.Successful) { BlazoredModal.Close(); } else { Errors = result.Errors; ShowErrors = true; } }
protected override async Task OnInitializedAsync() { try { _accounts = await UserRepository.GetAllMobileAccounts(); if (Account != null) { _selectedAccount = Account.Id; CheckHasSubs(); } } catch (Exception ex) { BlazoredModal.Close(); } }
protected async Task EditNotes() { ShowErrors = false; Console.WriteLine(EditNotesModel.CurrentNote); var result = await PlayerNoteService.Create(new CreateNoteModel { Description = EditNotesModel.CurrentNote, NotedPlayerName = NotedPlayerName }); if (result.Successful) { BlazoredModal.Close(); } else { Errors = result.Errors; ShowErrors = true; } }
protected async Task <bool> MessageBoxModal(string titulo, string conteudo, string icone, string textoConfirma = "Confirma", string textoCancela = "Cancela", bool isConfirmed = true, bool isHtml = false) { _ = BlazoredModal.Close().ConfigureAwait(false); bool choice = false; var myicone = (SweetAlertIcon)icone; if (!isConfirmed) { textoConfirma = "Ok"; } await Swal.FireAsync(new SweetAlertOptions { Title = titulo, Html = isHtml ? conteudo : null, Text = conteudo, AllowEnterKey = true, Icon = myicone, ShowCancelButton = isConfirmed, ConfirmButtonText = textoConfirma, CancelButtonText = textoCancela, CancelButtonColor = "error", AllowEscapeKey = true }).ContinueWith(swalTask => { SweetAlertResult result = swalTask.Result; if (result.Dismiss != DismissReason.Cancel) { choice = true; } else if (result.Dismiss == DismissReason.Cancel) { Swal.FireAsync( "Oops!!!!!", "Ação Cancelada!", SweetAlertIcon.Error ); } }); return(choice); }
public async Task CreateNewFranchisee() { var user = new Franchisee { FirstName = Input.FirstName, LastName = Input.LastName, Email = Input.Email, PhoneNumber = Input.PhoneNumber, Location = Input.Location }; IdentityResult result = await UserManager.CreateAsync(user, Input.Password); if (result.Succeeded) { Logger.LogInformation("Franchisee created a new account with password."); await EmailManager.SendConfirmationEmailAsync(user); } await BlazoredModal.Close(ModalResult.Ok(true)); }
protected async Task SaveSpecimenAsync() { var isNewSpecimen = Specimen.SpecimenId == 0; if (isNewSpecimen) { Specimen.DateCreated = DateTime.UtcNow; } else { Specimen.DateModified = DateTime.UtcNow; } if (SelectedLifeform != null) { Specimen.Lifeform = SelectedLifeform.LifeformId > 0 ? SelectedLifeform : null; } PopulateInventoryItemName(); Specimen.InventoryItem.Origin = SelectedOrigin; Specimen.InventoryItem.Name = Specimen.Name; Specimen.InventoryItem.Quantity = Specimen.Quantity; Specimen.Photos = UploadedPhotos.Any() ? UploadedPhotos : null; Specimen = await ApiClient.PutSpecimenAsync(Specimen); if (BlazoredModal != null) { await BlazoredModal.Close(ModalResult.Ok(Specimen)); } else { await CancelAsync(isNewSpecimen); } }
protected void Cancel() => BlazoredModal.Close();
private async Task Submit() { var hardwareId = await HttpClient.PostJsonAsync <int>("api/hardware", Command); await BlazoredModal.CloseAsync(ModalResult.Ok(hardwareId)); }
void CancelClicked() { BlazoredModal.Cancel(); }