Use of C# Razor Syntax in MVC.net view I have the code below and I am looking for input as to how I can improve it.

The main question here is should the code at the top in razor brackets be moved to the Controller and returned via a ViewModel?

The underlying question being, particularly when the code isnt controling styling is should the endeavour be to have as much as the C# code inside the controller as much as possilble, which i feel i am good at doing, and getting better at despite a few areas of lazyness.

@{
    var show = ViewBag.ShowBasket == "true";

    var visiblityLg = show ? "visible-lg" : "hidden hidden-lg";
    var visiblityMd = show ? "visible-md" : "hidden hidden-md";
    var visiblitySm = show ? "visible-sm" : "hidden hidden-sm";
    var visiblityXs = show ? "visible-xs" : "hidden hidden-xs";
}

&lt;a href="@Url.Action("Index", "ShoppingBasket")" class="navbar-icon navbar-icon-cart @visiblityLg" title="Shopping Basket"&gt;
    &lt;span class="fa fa-shopping-cart fa-4x text-warning"&gt;&lt;/span&gt;
&lt;/a&gt;


&lt;a href="@Url.Action("Index", "ShoppingBasket")" class="navbar-icon navbar-icon-cart-md @visiblityMd" title="Shopping Basket"&gt;
    &lt;span class="fa fa-shopping-cart fa-3x text-warning"&gt;&lt;/span&gt;
&lt;/a&gt;


&lt;a href="@Url.Action("Index", "ShoppingBasket")" class="navbar-icon navbar-icon-cart-sm @visiblitySm" title="Shopping Basket"&gt;
    &lt;span class="fa fa-shopping-cart fa-2x text-warning"&gt;&lt;/span&gt;
&lt;/a&gt;


&lt;a href="@Url.Action("Index", "ShoppingBasket")" class="@visiblityXs" title="Shopping Basket"&gt;
    &lt;span class="fa fa-shopping-cart text-warning"&gt;&lt;/span&gt;&amp;nbsp;Shopping Basket
&lt;/a&gt;
I would argue that the code in the top should not be moved to Controller.

This of course depends on how you define responsibilities for View, Controller and Model, but I would leave the code in the View because Controller and Model should not have knowledge about CSS if it can be avoided.

More about responsibilities in ASP.NET MVC