title: asp.net mvc without entity framework
body: <p>I am learning asp.net mvc and went through a great tutorial that demonstrated it. The tutorial also used Entity Framework. </p>
  
  <p>We have our own data access class which I have to use. 
  I am a little bit confused as to what I need to do to bridge the gap between our class and MVC framework. 
  For example, in the tutorial, inside of MovieController.cs file, there is a Edit method, that looks like this:</p>
  
  <pre><code>[HttpPost]
          public ActionResult Edit(Movie movie)
          {
              if (ModelState.IsValid)
              {
                  db.Entry(movie).State = EntityState.Modified;
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
              return View(movie);
          }
  </code></pre>
  
  <p>If I don't use the Entity framework, what would it look like? Will I still need to use ModelState.IsValid and save the state like it's done </p>
  
  <pre><code>db.Entry(movie).State = EntityState.Modified;
  </code></pre>
  
  <p>Please advise. A clearly written example of using asp.net mvc without the use of Entity framework would be great. </p>
  
  <p>What I need to know is what role does state play here and whether it is mandatory to use or is it just a part of how the Entity framework operates.</p>
  
  <p>I would re-write this as:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Edit(Movie movie)
  {
      myDBObject.SaveChanges();
      return RedirectToAction("Index");
  
  }
  </code></pre>
  
  <p>Where myDBObject is my custom database access object.</p>