title: Internal Server Error 500 angularjs, mvc HttpPost
body: <p>When I'm updating a row in the database I get this error: <a href="http://snag.gy/975mW.jpg" rel="nofollow">http://snag.gy/975mW.jpg</a></p>
  
  <p>Since it's a 500 error I'm guessing it's something in my C# code giving me this error, the strange thing is that the database gets updated and nothing crashes. So I'm wondering how I could debug this error? I'm sending the data from angular to a web api.</p>
  
  <pre><code> $scope.editUser = function () {
              var user = $scope.selectedUser;
              UserService.editUser(user).success(function (data) {
                  console.log('Updated', data)
              }).
              error(function () {
                  $scope.error = console.log('Something went wrong')
              });
          }
  
  
     [HttpPost]
      public User EditUser([FromBody]EditUserModel model)
      {
          var editedUser = db.Users.FirstOrDefault(u =&gt; u.UserID == model.UserID);
  
      editedUser.FirstName = model.FirstName;
      editedUser.LastName = model.LastName;
      editedUser.Email = model.Email;
  
      db.SaveChanges();
      return editedUser;
  }
  </code></pre>