Correct way of implementing a Model for a Dropdownlist .Net Core
<p>I'm currently trying to implement a Dropdown List with what I would assume is hardcoded values. Basically what I want is to have a Dropdown List with a choice of three possible values.</p>
<p>I have a total of 4 controllers and views that will be using this dropdown. I've seen a lot of examples for MVC2 and MVC3 where people have hard coded their dropdowns in their views, and I personally don't prefer to go with a quick and &quot;dirty&quot; fix such as that.</p>
<p>I have a model containing the following.</p>
<pre><code>public class Status
{
    public int id { get; set; }
    public string status { get; set; }

    public Status(int statusId, string statusName)
    {
        id = statusId;
        status = statusName;
    }
}
</code></pre>
<p>The status should be able to have any of the 3 possible values:</p>
<pre><code>Active
Inactive
Processing
</code></pre>
<p>I thought of creating the status' using this method I currently have in my status class:</p>
<pre><code>    public static List&lt;Status&gt; getAllStatus()
    {
        List&lt;Status&gt; states = new List&lt;Status&gt;();
        states.Add(new Status(1, &quot;Active&quot;));
        states.Add(new Status(2, &quot;Inactive&quot;));
        states.Add(new Status(3, &quot;Processing&quot;));
        return states;
    }
</code></pre>
<p>I haven't been able to figure out how to use this model inside my Controllers alongside with how to pass it along to my views and was hoping someone in here would known how to do that?</p>
<h1>EDIT1:</h1>
<p>I guess I forgot to mention that I will be storing the selected value as a string in my database and that I am using a view which doesn't have the model of my status class, but rather the model of object which I will be storing in my database (which might be the case of a vehicle object).</p>
<h1>EDIT2:</h1>
<p>I have a model called Customer, which has some of the following values:</p>
<pre><code>public int CustomerID { get; set }
public string Email { get; set }
public string Phone { get; set }
public Status Status { get; set; }
</code></pre>
<p>In my DB for my Customer model I have a string in which I wan to store the selected Status.</p>
<p>So basically I wan't to change the following to a dropdown with 3 options, <code>Inactive</code>, <code>Active</code> and <code>Processing</code>.</p>
<p><a href="https://i.stack.imgur.com/xZqZ8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xZqZ8.png" alt="enter image description here" /></a></p>
<p>However I don't want to code this in my view as I will be needing it in 8 different views and copy pasting that is not very <em>sleek</em> code.</p>