title: ado.net mvc3 tuple using in model and single views
body: <p>I have the following ADO Model</p>
  
  <p><strong>Student</strong>
  <em>Id,Name</em>
  and
  <strong>Course</strong>
  <em>Id,Name,Student_ID</em></p>
  
  <p>I have made the following view for it </p>
  
  <pre><code>@model Tuple&lt;MvcApplication4.Models.Course, MvcApplication4.Models.Student &gt;
  @{
      ViewBag.Title = "Create";
  }
  &lt;h2&gt;Create&lt;/h2&gt;
  @using (Html.BeginForm()) {
      @Html.ValidationSummary(true)
      &lt;fieldset&gt;
          &lt;legend&gt;Course&lt;/legend&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Item1.Name)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Item1.Name)
              @Html.ValidationMessageFor(model =&gt; model.Item1.Name)
          &lt;/div&gt;
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Item1.S_ID, "Student")
          &lt;/div&gt;
              &lt;fieldset&gt;
          &lt;legend&gt;Student&lt;/legend&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Item2.Name)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Item2.Name)
              @Html.ValidationMessageFor(model =&gt; model.Item2.Name)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Item2.Class)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Item2.Class)
              @Html.ValidationMessageFor(model =&gt; model.Item2.Class)
          &lt;/div&gt;
  
          &lt;p&gt;
              &lt;input type="submit" value="Create" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  
      &lt;/fieldset&gt;
  }
  </code></pre>
  
  <p>And the controller for it is as</p>
  
  <pre><code>public ActionResult Create()
  {
        return View();
  } 
  
  //
  // POST: /Default3/Create
  
  [HttpPost]
  public ActionResult Create(Tuple&lt;Student ,Course &gt; t)
  {
  
      try
      {
          // TODO: Add insert logic here
  
          db.Students.AddObject(t.Item1);
          db.SaveChanges();
  
          t.Item2.S_ID = t.Item1.Id;
          db.Courses.AddObject(t.Item2);
          db.SaveChanges();
  
          return RedirectToAction("Copy");
      }
      catch
      {
          return View();
      }
  }
  </code></pre>
  
  <p><strong>But When i click the Creat button it gives the following Error</strong></p>
  
  <blockquote>
    <blockquote>
      <p>Server Error in '/' Application.</p>
    </blockquote>
    
    <p>No parameterless constructor defined for this object.</p>
  </blockquote>