title: How to call a controller function from view in MVC 4
body: <p>I need to execute a function when user click on menu item, to populate some data in database table.</p>
  
  <p>example of function in controller:</p>
  
  <pre><code>        public void PopulateDatabase()
          {
              Populate();
          }
  </code></pre>
  
  <p>how can i call this function from View?</p>
  
  <p>EDIT:</p>
  
  <p>I create an ActionResult method that return a View to inform user that database updated succesfuly like this</p>
  
  <pre><code>    public ActionResult PopulateDatabase()
      {
          Populate();
          return View("Populate");
      }
  </code></pre>
  
  <p>and i call it from view with</p>
  
  <pre><code>&lt;a href="@Url.Action("PopulateDatabase", "ControllerName")" class="populate"&gt;Populate Database&lt;/a&gt;
  </code></pre>
  
  <p>i tested and working. Is there a better solution to achieve this??</p>