@using phronCare.UIBlazor.Services.Sales @using Blazored.Modal @using Blazored.Modal.Services @using Domain.Entities @inject DocumentTypeService documentTypeService @inject PatientService patientService @inject IToastService Toast @inherits OwningComponentBase
Nuevo Paciente
@foreach (var doc in documentTypes) { }
@code { [CascadingParameter] public BlazoredModalInstance ModalInstance { get; set; } = default!; private EPatient _model = new(); private List documentTypes = new(); protected override async Task OnInitializedAsync() { documentTypes = await documentTypeService.GetAllAsync(); } private async Task HandleValidSubmit() { var result = await patientService.CreateAsync(_model); if (result.IsSuccessStatusCode) { Toast.ShowSuccess("Paciente creado."); var newItem = new ELookUpItem { Id = _model.Id, Nombre = $"{_model.Firstname} {_model.Lastname}" }; await ModalInstance.CloseAsync(ModalResult.Ok(newItem)); } else { var error = await result.Content.ReadAsStringAsync(); Toast.ShowError($"Error: {error}"); } } private async Task Cancelar() { await ModalInstance.CancelAsync(); } }