public interface ILoginManager
{
IEnumerable GetLogins();
}
I have declared this methods in the interface and implemented in below class
class LoginManager : ILoginManager
{
private readonly ILoginRespository _loginRepository;
public LoginManager(ILoginRespository loginRepository)
{
_loginRepository = loginRepository;
}
public HR_Login Create(HR_Login login)
{
return _loginRepository.Create(login);
}
Now i am trying to access the method in webapi
private readonly ILoginManager _loginManager;
public LoginController()
{
}
public LoginController(ILoginManager loginManager)
{
this. _loginManager = loginManager;
}
[HttpGet, Route("logins")]
public HttpResponseMessage Get()
{
return Request.CreateResponse(HttpStatusCode.OK, _loginManager.GetLogins());
}
And when i complied this code... It is giving mr the Null Reference exception in the controller GET Method.

Manas MohapatraRank #182 · 13.2K reputationPosted Nov 28, 2016, 2:57 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Nov 28, 2016, 1:31 AM EST
Krishna Kumar116 reputationPosted Nov 28, 2016, 1:35 AM EST
Krishna Kumar116 reputationPosted Nov 28, 2016, 6:53 PM EST