title: How to delete a record in database using C#
body: <p>How do I remove a record?<br>
  I need to remove a record that I found by using the foreign key. I stored it as a var but now I can't delete it. Any suggestions?</p>
  
  <pre><code>// POST: Account/Delete/5
  [HttpPost]
  [ValidateAntiForgeryToken]
  public ActionResult Delete(int id, Leerling ll)
  {
      var login = from l in db.myLogin
                  where id == l.leerlingId
                  select l;
      db.myLogin.Remove(login???);
      db.Entry(ll).State = System.Data.Entity.EntityState.Deleted;
      db.SaveChanges();
  
      return RedirectToAction("Index");// het record verwijderen en redirecten als het gelukt is
  }
  </code></pre>