public dynamic RetornoTotalOcorrencia([FromBody] FiltroOcorrenciaCommands command) { try { if (!command.IsValid()) { return(new ComandResult(false, "Por favor corrija os campos abaixo", command.Notifications)); } byte[] file; var retorno = _ocorrenciaRepositorio.RetornoTotalOcorrencia(command); var obj = TemplateGenerator.TotalOcorrencias(retorno); var pdf = RetornoPdf.Retorno(obj, "assets", "styles.css", Orientation.Landscape); file = _converter.Convert(pdf); return(File(file, "application/pdf")); } catch (NullReferenceException ex) { return(ex.Message); } }
public IComandResult Handle(FiltroOcorrenciaCommands comand) { var ocorrencia = new List <ListarOcorrenciaResults>(); if (!comand.IsValid()) { return(new ComandResult(false, "Por favor corrija os campos abaixo", comand.Notifications)); } switch (comand.TipoFiltro) { case "serie": ocorrencia = _repository.FiltrarPorSerie(comand); return(new ComandResult(true, "Ocorrencias!!", new { ocorrencia })); case "aluno": ocorrencia = _repository.FiltrarPorAluno(comand); return(new ComandResult(true, "Ocorrencias!!", new { ocorrencia })); default: return(new ComandResult(true, "Ocorrencias!!", new { ocorrencia })); } }