@using BLAIzor.Models @using BLAIzor.Services @using Microsoft.AspNetCore.Identity.UI.Services @inject IEmailSender _emailService

Contact us!

@* *@
@code { [Parameter] public ContactFormModel ContactFormModel { get; set; } private string? SuccessMessage; private string? ErrorMessage; [Parameter] public string? DocumentEmailAddress { get; set; } = ""; [Parameter] public EventCallback OnDataChanged { get; set; } private async Task HandleValidSubmit() { try { // Simulate sending an email await ((EmailService)_emailService).SendEmailAsync(ContactFormModel, DocumentEmailAddress); SuccessMessage = "Thank you for contacting us! Your message has been sent."; ErrorMessage = null; // Clear the form ContactFormModel = new(); } catch (Exception ex) { ErrorMessage = "An error occurred while sending your message. Please try again later."; SuccessMessage = null; } } protected override void OnInitialized() { } private void OnSubmit(object data) { } async Task ContentChanged() { Console.Write("Data changed!!"); await OnDataChanged.InvokeAsync(); } protected override void OnParametersSet() { Console.WriteLine($"form initialized: {DocumentEmailAddress}"); } }