title: Need help explaining ajax post error
body: <pre><code>private readonly UserService userService;
  
      public AccountController(UserService userService)
      {
          this.userService = userService;
      }
  
      [HttpPost]
      public ActionResult Login(string username, string password)
      {
          bool validUser = this.userService.ValidateUser(username, password);
         // bool validUser = UserService.ValidateUser(username, password);
          if (validUser)
          {
              FormsAuthentication.SetAuthCookie(username, true);
              return Json(new
                  {
                      valid = true,
                      action = "Views/Home/Index"
                  });
          }
          else
          {
              return Json(new
                  {
                      valid = false,
                      action = "Views/Account/_LoginPartial"
                  });
          }
      }
  </code></pre>
  
  <p>My ajax post can't reach the method <code>Login</code> because of the:</p>
  
  <pre><code> private readonly UserService userService;
  
      public AccountController(UserService userService)
      {
          this.userService = userService;
      }
  </code></pre>
  
  <p>If I delete this code it works. But why?
  How can I use <code>userService</code> in my Login-method without instantiating it like that?</p>