title: LINQ2SQL: Update an entity field that has a reference to another entity
body: <p>I have the following situation in LINQ: I have an object (a blog "Post") that has a "Status" field which can take on different values, and there's a table listing all these values (this table just has Id, Desc).<br>
  Now, since the relationship between both tables is created, in the Model, Post.Status is not an int, but an instance of "PostStatus".  </p>
  
  <p>Thus, if I want to set the status of a Post to, say, 20, I can't just set the field to 20, I need to have an instance of PostStatus to assign. These status values are all hardcoded with the logic, so it's just fine to have "20" hardcoded in my code.<br>
  Is there a better way to do it that this?</p>
  
  <pre><code>switch (Action) {
   case "Ignore":
    post.PostStatus = (from s in db.PostStatus where s.Id == 90 select s).First();
    break;
   case "Assign":
    post.PostStatus = (from s in db.PostStatus where s.Id == 20 select s).First();
    break;
   case "MarkDone":
    post.PostStatus = (from s in db.PostStatus where s.Id == 30 select s).First();
    break;
   case "MarkPublished":
    post.PostStatus = (from s in db.PostStatus where s.Id == 40 select s).First();
    post.Public = true;
    break;
  }
  </code></pre>
  
  <p>I hate this code, honestly, first of all because it needlessly queries the DB to get a PostStatus instance, but mostly because it's just so verbose.<br>
  Is there a better way to do this?</p>
  
  <p>Thanks!<br>
  Daniel</p>