I am fetching records for a user based on his UserId
as a JsonResult...
public JsonResult GetClients(int currentPage, int pageSize)
{
if (Session["UserId"] != "")
{
var clients = clirep.FindAllClients().AsQueryable();
var count = clients.Count();
var results = new PagedList<ClientBO>(clients, currentPage - 1, pageSize);
var genericResult = new { Count = count, Results = results };
return Json(genericResult);
}
else
{
//return RedirectToAction("Index","Home");
}
}
How to redirect to a controller action from a JsonResult method in asp.net mvc?Any suggestion...
EDIT: This doesn't seem to work...
if (Session["UserId"] != "")
{
var clients = clirep.FindAllClients().AsQueryable();
var count = clients.Count();
var results = new PagedList<ClientBO>(clients, currentPage - 1, pageSize);
var genericResult = new { Count = count, Results = results ,isRedirect=false};
return Json(genericResult);
}
else
{
return Json({redirectUrl = Url.Action("Index", "Home"), isRedirect = true });
}