title: How to edit using ViewData model
body: <p>I have created a View Model based on combination of three Tables. </p>
  
  <p>I click on Edit action it displays the Data from Three tables correctly.</p>
  
  <p>But when i click  on Save button i am not able to get data either from FormCollection or from Request["Id"]</p>
  
  <p>Please suggest it the possible way.</p>
  
  <p>public class ConferenceResourceEditModel
      {</p>
  
  <pre><code>    public ConferenceRoom ConferenceRoom { get; set; }
  
      public Resources Resources { get; set; }
  
      public ResourceAllocation ResourceAllocation { get; set; }
  
  }
  </code></pre>
  
  <p>public ActionResult Edit(int id)<br>
   {</p>
  
  <p>//ConferenceRoom conferenceroom = db.ConferenceRooms.Find(id);     </p>
  
  <pre><code>        var query =
  
                 from c in db.ConferenceRooms
  
                 from r in db.Resourcess
  
                 from ra in db.ResourceAllocation
  
                 where c.ConferenceID == id
  
  
                 where c.ConferenceID == ra.ConferenceID 
  
                 where r.ResourceID ==ra.ResourceID 
  
                 select new ConferenceResourceEditModel { ConferenceRoom = c, Resources = r,ResourceAllocation=ra };
  
          return View(query);       
      }
  
      //
      // POST: /ConferenceRoom/Edit/5
  
      [HttpPost]
      public ActionResult Edit(FormCollection form, int id, ConferenceResourceEditModel conferenceroom,ConferenceRoom crf)
      {
  
          if (ModelState.IsValid)
          {
              db.Entry(conferenceroom).State = EntityState.Modified;
              db.SaveChanges();
              return RedirectToAction("Index");
          }
          return View(conferenceroom);
      }
  </code></pre>