title: Controller action not being called on button click
body: <p>I have an ASP .Net core MVC 2.0 app where I implemented a shopping cart for an e-commerce site as outlined <a href="https://www.youtube.com/watch?v=yeulQdm6GBI" rel="nofollow noreferrer">in this video series</a>. In the app, user can enter search queries for items which are displayed in a table. Each item in the table can be clicked on to display another page that has additional details for that item as well as a add to cart button. </p>
  
  <p>The site features for searching, displaying the item results, and the details page are all implemented as actions in one controller class while the shopping cart functionality is all implemented in a separate controller class. </p>
  
  <p>For some reason, when I click on the "Add to Cart" button for an item, a url of the form <code>http://&lt;hostname&gt;/&lt;controllerName&gt;/&lt;controllerACtion&gt;/&lt;id&gt;</code>is requested, but the corresponding controller action isn't called. This is strange because I'm using essentially the same code to call the action for adding to shopping cart as I did for displaying details. For this reason, I think the issue is related to the setup of the routes.</p>
  
  <p>Here is the route setup in startup.cs:</p>
  
  <pre><code>app.UseMvc(routes =&gt;
  {
      routes.MapRoute(
          name: "default",
          template: "{controller=resortDeals}/{action=Index}/{id?}");
      routes.MapRoute(
          name: "shoppingcart",
          template: "{controller=ShoppingCartController}/{action=AddToShopingCart}/{id?}");
  });
  </code></pre>
  
  <p>Here is the shopping cart controller structure: </p>
  
  <pre><code>public class ShoppingCartController : Controller
  {
      public ViewResult Index()
      {
          ...
      }
  
      public RedirectToActionResult AddToShopingCart(int dealId)
      {
          ...
      }
  }
  </code></pre>
  
  <p>Below is the code for how the action is being called once the add to cart button is clicked:</p>
  
  <pre><code>&lt;div class="addToCart text-right"&gt;
      &lt;p class="button "&gt;
          &lt;a class="btn btn-success" id="cartButton" asp-controller="ShoppingCartController" asp-action="AddToShoppingCart" asp-route-id="@Model.RecNo"&gt;
              Add to cart
          &lt;/a&gt;
      &lt;/p&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>What could be preventing the controller action from being called once the button is clicked?</p>