title: How simplify my request code?
body: <p>I use this part of code to get informations from my database, using Entity Framework, and add all of it in a IEnumerable property for, at the end, a DropDownListFor display.
  I need to use that kind a code many time so I would like to make it the most powerfull at the begenning. </p>
  
  <pre><code>public IEnumerable&lt;SelectListItem&gt; Functions { get
      {
          List&lt;SelectListItem&gt; result = new List&lt;SelectListItem&gt;();
          using (followupconsultantEntities dataModel = new followupconsultantEntities())
          {
              var myEvents = from e in dataModel.functions
                             select e;
              foreach (var function in myEvents)
              {
                  SelectListItem myList = new SelectListItem
                                              {
                                                  Value = function.ID_Function.ToString(CultureInfo.InvariantCulture),
                                                  Text = function.FU_Name
                                              };
                  result.Add(myList);
              }
          }
          return result;
      } }
  </code></pre>
  
  <p>Thanks for help</p>
  
  <p>The view:</p>
  
  <pre><code>&lt;div class="editor-field"&gt;
  &lt;%: Html.DropDownListFor(m =&gt; m.SelectedFunction,Model.Functions) %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>For information, my controller:</p>
  
  <pre><code>public ActionResult Register()
      {
          ViewData["PasswordLength"] = MembershipService.MinPasswordLength;
          return View(new RegisterModel());
      }
  </code></pre>