I have a Action HttpGet
, where this Action
gets two parameters, dataInicial
, and dataFinal
, this generates a report, in the same Action
. only I would like to send this data (List) to another screen, where it is already ready for A4 size printing, I would like to know just how to send this data to this other view, I already tried to use return RedirectToAction("RelatorioTotalPorDatadois", vrDb);
but did not right.
public ActionResult RelatorioData(DateTime? dataInicio, DateTime? dataFim)
{
ViewBag.dataInicial = dataInicio;
ViewBag.dataFinal = dataFim;
if (dataInicio == null && dataFim == null)
{
var vrDb = db.VrDb.Where(v => v.DataSolicitacao >= dataInicio && v.DataSolicitacao <= dataFim).OrderBy(v => v.DataSolicitacao).ToList();
return View(vrDb);
}
else
{
var vrDb = db.VrDb.Where(v => v.DataSolicitacao >= dataInicio && v.DataSolicitacao <= dataFim && v.Situacao == Situacao.Finalizado).OrderBy(v => v.DataSolicitacao).ToList();
var data = dataInicio;
var dataF = dataFim;
var tot = db.VrDb.Sum(v => v.Mv.Consumo); //Mostra o Total gasto
if (tot == 0)
{
ViewBag.Total = "0";
}
else
{
ViewBag.Total = tot;
}
var abastecido = db.VrDb.Sum(v => v.Mv.CombustivelAbastecido);
if (abastecido == 0)
{
ViewBag.Abastecido = "0";
}
else
{
ViewBag.Abastecido = abastecido;
}
ViewBag.ListaDb = vrDb;
return View(vrDb);
//return RedirectToAction("RelatorioTotalPorDatadois", vrDb);
}
}
This is the screen of this Action
:
ButI'dliketoputabuttononthisscreenwiththePrintoption:Wherethisdatawasloadedontoanotherscreen