I have controller:
void user()
{
var user = (from ....);
if(user !=null)
{
......
}
else
RedirectToAction("Index", "Home");
}
public ActionResult xyz()
{
user();
return View();
}
If user is null is make
RedirectToAction(“Index”, “Home”);
but it no redirect but return View in xyz() method. How make redirect who will go to another View. And stop making xyz() method. It will be very useful if I mustn’t change something in xyz method.
Try this: