protected virtual async Task <bool> Salvar(EditContext editContext) { if (!editContext.Validate()) { return(false); } HttpResponseMessage httpResponse; if (!default(TId).Equals(Id)) { httpResponse = await HttpServico.PutAsync(Id, _dto); } else { httpResponse = await HttpServico.PostAsync(_dto); } if (httpResponse.IsSuccessStatusCode) { ToastService.ShowSuccess("Registro salvo com sucesso"); } else { ToastService.ShowError("Falha ao tentar salvar o registro!"); return(false); } NavigationManager.NavigateTo(AposSalvarRetonarPara); return(true); }
protected async override Task <bool> Salvar(EditContext editContext) { _carregando = true; StateHasChanged(); if (string.IsNullOrEmpty(_dto.LinkResultadoExame) && _dto.StatusExame.Id == StatusExameConst.EmAnaliseLaboratorial) { ToastService.ShowWarning("Não foi realizado o envio do resultados!"); _carregando = false; StateHasChanged(); return(false); } _dto.LaboratorioRealizouExameId = ApplicationState.UsuarioLogado.Id; _dto.StatusExame.Id = _dto.StatusExame.Id == StatusExameConst.Pendente ? StatusExameConst.EmAnaliseLaboratorial : StatusExameConst.Concluido; await HttpServico.PutAsync(_dto.Id, _dto); await JSRuntime.ForceReloadAsync(); return(true); }