Below is my method, which calls a stored procedure.
public List<int> GetActivityListforUser(string userId)
{
IList<int> results = new List<int>();
context.LoadStoredProc("dbo.GetRegionOrganizationActivities")
.WithSqlParam("userId", userId)
.ExecuteStoredProc((handler) =>
{
results = handler.ReadToList<int>().ToList();
});
return results.ToList();
}
My stored procedure dbo.GetRegionOrganizationActivities
, returns only one column Id, which is the required result up on passing the parameter userId.
My issue is in the following line:
return results.ToList();
I can see all the list that comes from the stored procedure, but all int values are 0. The list count matches with stored proc result count, but values should be example: 1,2,3, etc. it shows 0,0,0, etc.
Can any one provide some insight on what I am doing wrong?