Say I have:
public ViewResult List()
{
IEnumerable myList = repository.GetMyList();
if(1 == myList.Count())
{
RedirectToAc
You need to return RedirectToAction
instead of just calling the RedirectToAction method. Also, your method will need to return an ActionResult
is a return type compatible with both ViewResult
and RedirectToRouteResult
.
public ActionResult List()
{
IEnumerable<IModel> myList = repository.GetMyList();
if(1 == myList.Count())
{
return RedirectToAction("Edit", new { id = myList.Single().id });
}
return View(myList);
}