My Web API is as under
[HttpGet]
[Route("SearchLead")]
public IEnumerable<LeadSearchResult> SearchLead1(LeadSearchCriteria searchCriteria)
{
return leadRepository.SearchLead(searchCriteria);
}
I am invoking as
http://localhost:52388/LeadAPI/SearchLead
But I am getting NULL Reference exception.
public class LeadSearchCriteria
{
LeadSearchCriteria() { }
public int ProductID { get; set; }
public int ProductProgramId { get; set; }
}
What mistake I am making?
Postman
{
"ProductID": 1,
"ProductProgramId": 1
}
ERROR
{
"Message": "An error has occurred.",
"ExceptionMessage": "Object reference not set to an instance of an object.",
"ExceptionType": "System.NullReferenceException",
"StackTrace": " at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()"
}