Skip to main content
3 of 3
added 120 characters in body

You should pass your AccountListFilterModel to the view, either via model (which is the best solution as it's less error-prone) or using ViewBag \ ViewData (which is an anti-pattern actually, but fits the quick-fix niche). Using the latter approach:

In your controller:

public ViewResult Index(AccountListFilterModel accountListFilter)
{
    ViewBag.Filter = accountListFilter;
}

In your view (you can delete the code at the top of the view, that uses Request to get parameters.

<a style="@(ViewBag.Filter.currentSortOrder == "UserName desc" ? "" : "display:none;")" ... />

It's a general rule of thumb that your view should not contain any logic at all, your controller should supply all the data that the view needs.