@Html.DropDownListFor - How to append extra <option> to list
<p>I have the following in my view:</p>

<pre><code>@Html.DropDownListFor(m =&gt; m.Category, new SelectList(Model.categories, "Id", "Name", Model.Category), "All", new { @class = "form-control" })

&lt;select name="Category" id="Category"&gt;
 &lt;option value=""&gt;All&lt;/option&gt;
 &lt;option value="1"&gt;Debug&lt;/option&gt;
 &lt;option value="2" selected="selected"&gt;Error&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>In my repo I get the values as follows:</p>

<pre><code>    public IEnumerable&lt;Category&gt; GetCategories()
    {
        return _context.Category.ToList();
    }
</code></pre>

<p>How do I give <code>All</code> a value of 0 instead of empty string?</p>

<p>Is there any way to append it to my repo method below as I'd like to keep my controller clean.</p>

<pre><code>public IEnumerable&lt;SelectListItem&gt; GetCategoriesSelectList()
    {

        return _context.Category
             .Select(s =&gt; new SelectListItem
             {
                 Value = s.Id.ToString(),
                 Text = s.Name
             }).ToList();


    }
</code></pre>

<p><strong>*UPDATE *</strong></p>

<p>I've found the following helper but cant figure out how to use it:</p>

<pre><code> public static SelectList AddFirstItem(SelectList origList, SelectListItem firstItem)
    {
        List&lt;SelectListItem&gt; newList = origList.ToList();
        newList.Insert(0, firstItem);

        var selectedItem = newList.FirstOrDefault(item =&gt; item.Selected);
        var selectedItemValue = String.Empty;
        if (selectedItem != null)
        {
            selectedItemValue = selectedItem.Value;
        }

        return new SelectList(newList, "Value", "Text", selectedItemValue);
    }
</code></pre>

<p>In my view I have :</p>

<pre><code> @Html.DropDownListFor(m =&gt; m.Category, Helpers.AddFirstItem(new SelectList(Model.categories, "Id", "Name", Model.Category), "All"), null, new { @class = "form-control" })
</code></pre>

<p>What do I pass in as the second argument - the above doesnt work?</p>