title: In my model, I've got a piece of information that can be shown in two different ways. If I create two fields for both ways, how can I link the two?
body: <p>I have a list of tasks that have both a numerical code and a name. For example:</p>
  
  <pre><code>100 - "Sweep floor"
  200 - "Do laundry"
  300 - "Walk the dogs"
  </code></pre>
  
  <p>In my model, I'd like to have something like the following:</p>
  
  <pre><code>public class Task
  {
      public int TaskID { get; set; }
      public int TaskNumber { get; set; }
      public string TaskName { get; set; }
  }
  </code></pre>
  
  <p>When creating a <code>Task</code>, if the user selects "100" for the <code>TaskNumber</code>, I'd like the <code>TaskName</code> to change to "Sweep floor". Vice versa, if a user selects the <code>TaskName</code> "Sweep floor", I'd like the <code>TaskNumber</code> to change to "100".</p>
  
  <p>The purpose of having them separate is in case a user only knows the name or only knows the number of a task. The fields would be sorted numerically and alphabetically so they could quickly find the task they're looking for.</p>
  
  <p>I understand that one solution to this is to simply create a JavaScript function that watches both the fields. When one of the field changes, the other changes to match it.</p>
  
  <p>Is there a better solution than that? I'd rather make something like an<code>Enum</code> for <code>TaskNumber</code> and <code>TaskName</code> and have them be linked somehow instead of hardcoding a solution in JavaScript.</p>