title: How to update data from database by clicking button with angularjs
body: <p>I am new with angular so got issue. Main idea of my mini project is that I have to show data from database. Everything should be shown in View by calling api and request to database.To show current data now is working. Now I want to update data from database by clicking button, but unfortunately I don't what kind of function I have to write in my controller.
  Here is my DataGridView.js</p>
  
  <pre><code>var app = angular.module('myApp', ['ngResource']);
  app.controller('myCtrl', function ($scope, $resource, $http, $routeParams, $location) {
  
      var Users = $resource('/api/tables');
      $scope.users = Users.query(function () {
          //console.log(user);
      });
  });
  </code></pre>
  
  <p>Here is my (API) Tables1Controller.cs ,only main method</p>
  
  <pre><code>public string GetTables()
          {
              JavaScriptSerializer jss = new JavaScriptSerializer();
              return jss.Serialize(db.Tables);
          } 
  </code></pre>
  
  <p>And here is my Index where I show data, and I added button</p>
  
  <pre><code>&lt;table class="table"&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Id&lt;/th&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Surname&lt;/th&gt;
              &lt;th&gt;Address&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr ng-repeat="user in users"&gt;
              &lt;td&gt;{{user.Id}}&lt;/td&gt;
              &lt;td&gt;{{user.Name}}&lt;/td&gt;
              &lt;td&gt;{{user.Surename}}&lt;/td&gt;
              &lt;td&gt;{{user.Address}}&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  
  &lt;div ng-repeat=&gt;
      {{ user.Name }}
      a
  &lt;/div&gt;
  &lt;div class="btn btn-danger"&gt;Button&lt;/div&gt;
  </code></pre>
  
  <p>At _Layout.cshtml I added ng-app and ng-controller in body. What would be the best solution?</p>
  
  <p>Edit: I know it should start something with ng-click near button, but I don't kow how to write function to update.</p>