title: how to pass multiple parameters between view and controller in .net core 2.0?
body: <p>in the conversion between traditional MVC and .net core, i am coming across something quirky when I use almost the same code in  both technologies.</p>
  
  <p>I am passing parameters of both an id field and the name of the sending controller from the  view to the receiving controller. The  code below works in traditional MVC:</p>
  
  <pre><code>&lt;td&gt;
      @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
      @Html.ActionLink("Details", "Details", new { id = item.Id }) |
      @Html.ActionLink("Delete", "Delete", new { id = item.Id })
      @Html.ActionLink("New Comment", "Create", "ServiceRequestNotes", new { ServiceRequest = item.Id, returncontroller = "ServiceRequests" }, null)&lt;br /&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>And </p>
  
  <pre><code>// POST: ServiceRequestNotes/Create
  // To protect from overposting attacks, please enable the specific properties you want to bind to, for
  // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
  [HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;ActionResult&gt; Create([Bind(Include = "Id,NoteDescription,LastUpdated,WrittenBy,ServiceRequest")] ServiceRequestNote serviceRequestNote, string returncontroller)
  {
      if (ModelState.IsValid)
      {
          db.ServiceRequestNotes.Add(serviceRequestNote);
          serviceRequestNote.LastUpdated = DateTime.Now;
          serviceRequestNote.WrittenBy = User.Identity.Name;
          await db.SaveChangesAsync();
          //return Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString());
              return RedirectToAction("Index", returncontroller);
      }
      ViewBag.ServiceRequest = new SelectList(db.ServiceRequests, "Id", "RequestHeading", serviceRequestNote.ServiceRequest);
      return View(serviceRequestNote);
  }
  </code></pre>
  
  <p>The returncontroller value is populated immediately when i debug and it saves successfully</p>
  
  <p>I have almost the same code in .net Core</p>
  
  <pre><code>&lt;td&gt;
      &lt;a asp-action="Edit" asp-route-id="@item.Id"&gt;Edit&lt;/a&gt; |
      &lt;a asp-action="Details" asp-route-id="@item.Id"&gt;Details&lt;/a&gt; |
      &lt;a asp-action="Delete" asp-route-id="@item.Id"&gt;Delete&lt;/a&gt; |
      @Html.ActionLink("New Comment", "Create", "ServiceRequestNotes", new { ServiceRequest = item.Id, returncontroller = "TeamServiceRequests" }, null)&lt;br /&gt;
  &lt;/td&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>// POST: ServiceRequestNotes/Create
  // To protect from overposting attacks, please enable the specific properties you want to bind to, for 
  // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
  [HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;IActionResult&gt; Create([Bind("Id,NoteDescription,LastUpdated,WrittenBy,ServiceRequest")] ServiceRequestNotes serviceRequestNotes, string returncontroller)
  {
      if (ModelState.IsValid)
      {
          _context.Add(serviceRequestNotes);
          serviceRequestNotes.LastUpdated = DateTime.Now;
          serviceRequestNotes.WrittenBy = User.Identity.Name;
          await _context.SaveChangesAsync();
          //return RedirectToAction(nameof(Index));
          return RedirectToAction("Index", returncontroller);
      }
      ViewData["ServiceRequest"] = new SelectList(_context.ServiceRequests, "Id", "RequestDescription", serviceRequestNotes.ServiceRequest);
      return View(serviceRequestNotes);
  }
  </code></pre>
  
  <p>However in debugging- when it reaches the public async create line, the value of returncontroller is null.</p>
  
  <p>It still saves the comment, but because the above is null it return to the index view of notescontroller rather than the originating one.</p>
  
  <p>Anybody have any idea why in .net core, the returncontroller value is coming up as null when the code is almost identical? Thanks</p>