title: How to submit changes to database table in mvc using linq to sql
body: <p>I've typically done this using edmx's but this time in order to use cascading drop downs in my project I had to switch to use linq to sql.</p>
  
  <p>Anyway here is what I've tried</p>
  
  <pre><code>[HttpPost]
      public ActionResult Modules(ModuleViewModel mvm, FormCollection fc)
      {
          AllCourseDetail ACD = _dc.AllCourseDetails.Where(x =&gt; x.IdACD == mvm.cd.IdACD).FirstOrDefault();
          ACD = mvm.cd;
          if (ModelState.IsValid)
          {                
              UpdateModel(mvm);
              _dc.AllCourseDetails.Where(w =&gt; w.IdACD == mvm.cd.IdACD);
              UpdateModel(mvm.cd);
              _dc.SubmitChanges();
              Session.Add("redirectedEditcompletedsubmission", "yes");
              return RedirectToAction("List");
          }
          else
          {
              Session.Add("redirectedEditvalidation", "yes");
              return RedirectToAction("Index", "Home");
          }
      }
  </code></pre>
  
  <p>At 1st I didn't have anything above the if statement and inside I only had updatemodel and submit changes but no matter what combination I try it just doesn't save.</p>
  
  <p>Also mvm.cd is the AllCourseDetail table which is referenced in the viewmodel as cd and I have to use a view model as </p>