public IHttpActionResult LoginUser(LoginModel loginData) { try { if (ModelState.IsValid) { user existingUser = bllService.UserLogin(loginData.Username, loginData.Password); existingUser.userTests = null; existingUser.role = null; if (existingUser != null) { return(Ok(existingUser)); } else { return(BadRequest("Invalid username or password")); } } else { return(BadRequest("Invalid Request")); } } catch (Exception) { throw; } }