title: returning a DB record via EF in ASP.NET
body: <p>I am still new to programming and am working on this project where I got stuck after submitting data to a table in SQL using the entity framework. Although this all works fine, I am struggling returning the record I have just submitted. The challenge for me lies within combining multiple arguments to identify the record.</p>
  
  <p>The goal is to return a record based on <strong>UserID</strong> and the <strong>errandID</strong>.
  My controller looks as follows:</p>
  
  <pre><code>public ActionResult errandPreview()
          {
              var userID = User.Identity.GetUserId();
              var errandID = DB.errandList.Find(userID).ID;
              var model = new errands
              {
                  //Title = DB.errandList.Find(errandID).Title.ToString(),
                  Title = DB.errandList.Where(x =&gt; x.ID == errandID).FirstOrDefault().ToString()
              };
              return View();
          }
  </code></pre>
  
  <p>I am trying to get the UserID from the logged in user and then select the errandID via this attribute to ultimately get to the title of the errand (along with other stuff...) but I just can't get it done. Your help is appreciated!</p>