public async Task <IHttpActionResult> GetUserByLogin() { try { string data = await Request.Content.ReadAsStringAsync(); var query = JsonConvert.DeserializeObject <LdapUserQuery>(data); var ldap = new LdapHelper(query.Server); var user = ldap.GetUserByLogin(query.LoginName); if (user == null) { throw new System.Exception($"Unable to find user: {query.LoginName}"); } return(Ok(user)); } catch { return(NotFound()); } }