Skip to content

Instantly share code, notes, and snippets.

@jpolvora
Last active December 10, 2015 18:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpolvora/4474602 to your computer and use it in GitHub Desktop.
Save jpolvora/4474602 to your computer and use it in GitHub Desktop.
public ActionResult JsonQuery<T>(IEnumerable<T> resultado, Func<IEnumerable<T>, PartialViewResult> partialView)
{
if (resultado.Any()) return partialView(resultado); //instancia a PartialViewResult
return Json(string.Empty, JsonRequestBehavior.AllowGet);
}
//uso:
return JsonQuery(resultado, x => PartialView("ResultadosDaPesquisa", x));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment