public async Task <ActionResult> Finalize(IFormCollection collection) { try { var command = new FinalizeRelatoCommand { CodRelato = int.Parse(collection["CodRelato"].ToString()), //Rn0048 FlgStatusRelato = (int)EnumStatusRelato.Finalizado, DscFinalizacao = "Ocorrência finalizada, " + DateTime.Now.ToString("dd/MM/yyyy") + ", " + DateTime.Now.ToString("hh:mm"), AlteradoPor = User.Identity.Name, }; var relato = ApiClientFactory.Instance.GetRelatoById(command.CodRelato); //Rn0088 - deve ser implementada após finalizar o caso de uso de parecer tecnico if (true) { await ApiClientFactory.Instance.FinalizeRelato(command); } //Rn0047 if (!string.IsNullOrEmpty(relato.EmailRelator)) { await SendRn0047Email(relato); } return(RedirectToAction(nameof(Index), new { notify = 0, message = "Atendimento finalizado com sucesso." })); } catch (Exception e) { return(View()); } }
public Task <long> FinalizeRelato(FinalizeRelatoCommand command) { var requestUrl = CreateRequestUri(string.Format(System.Globalization.CultureInfo.InvariantCulture, $"{ResourceRelato}/FinalizeRelato")); return(Post(requestUrl, command)); }
public async Task <ActionResult <long> > FinalizeRelato(FinalizeRelatoCommand command) { try { var result = await Mediator.Send(command); return(result); } catch (Exception e) { Console.WriteLine(e); throw; } }