0
kunnummal created
Hi, How to call this method in webservice "_loginManager.LoginAsynbc(User,Password,TenatName)"
Please check my web service code
public class LoginSample : System.Web.Services.WebService
{
private readonly LogInManager _logInManager;
public LoginSample(
LogInManager logInManager)
{
_logInManager = logInManager;
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public int GetTenant(string strTenancy, string strUser, string strPassword)
{
int n = 0;
var result = _logInManager.LoginAsync(strUser, strPassword, strTenancy);
switch (result.Result.Result)
{
case AbpLoginResultType.Success:
return result.Result.Tenant.Id;
// break;
default:
return n;
// break;
}
}
}
1 Answer(s)
-
0
Hi @kunnummal,
I think your LoginSample service is not created with dependency injection, so because of that, LogInManager will not be created.
Instead of injecting LogInManager in constructor, you can use IocManager.Instance.Resolve<LoginManager> to get an instance and use it in your code.
Don't forget to dispose LoginManager instance because you are resolving it manually.
Thanks.
Have an answer to this question?
Log in
and write your answer.