1
I created the code below that generates a list. It checks whether the list contains any data saved in it or not. If you have data, returns a View with the list inside, if you have no data, returns null
.
How to do to, rather than return null
, display a warning on the page stating that there is no data to be shown?
[HttpPost]
public ActionResult Relatorio(string ocupacaoId, string instrumentoRegistroId)
{
List<ProcedimentoOcupacaoRegistro> listaprocedimentoocupacaoregistro = new ProcedimentoOcupacaoRegistro().listaProcedimentoOcupacaoRegistro(ocupacaoId, instrumentoRegistroId);
ViewBag.ocupacaoId = ocupacaoId;
ViewBag.instrumentoregistroId = instrumentoRegistroId;
if (listaprocedimentoocupacaoregistro.Count > 0)
{
return View(listaprocedimentoocupacaoregistro)
}
else
{
return null; // <<---AQUI EU QUERO ALTERAR
}
}