title: ASP.NET MVC - How to call void controller method without leaving the view?
body: <p><strong><em>Question background:</em></strong></p>
  
  <p>I am implementing some basic 'shopping cart' logic to an MVC app. Currently when I click a link - denoted as 'Add To Cart' on the screen shot below this calls to an 'AddToCart' method in the 'ProductController' as shown:</p>
  
  <p><img src="https://i.stack.imgur.com/sv7zM.jpg" alt="enter image description here"></p>
  
  <p><strong><em>Product.cshtml code:</em></strong></p>
  
  <pre><code>@Html.ActionLink("Add To Cart", "AddToCart")
  </code></pre>
  
  <p><strong><em>'AddToCart' method in the ProductController:</em></strong></p>
  
  <pre><code>public void AddToCart()
  {
     //Logic to add item to the cart.
  }
  </code></pre>
  
  <p><strong><em>The issue:</em></strong></p>
  
  <p>Not an issue as such but currently when I click the 'Add To Cart' button on the ActionLink on the ProductDetail.cshtml view the page calls the 'AddToCart' method on the ProductController and gives a blank view on the page - as shown below. <strong><em>I want the view to stay on 'ProductDetail.cshtml' and just call the 'AddToCart' method, how do I do this?</em></strong></p>
  
  <p><img src="https://i.stack.imgur.com/su0XT.jpg" alt="enter image description here"></p>