These are my model and I am using entity framework code first approach.
public class Respondent
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RespondentId { get; set; }
public User Requester { get; set; }
public User Provider { get; set; }
public string Role { get; set; }
[NotMapped]
public ICollection<User> Providers { get; set; }
}
public class User
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public int UPI { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public bool IsPublic { get; set; }
[NotMapped]
public string Profile_Pic { get; set; }
[NotMapped]
public string Role { get; set; }
[NotMapped]
public List<string> Roles { get; set; }
}
Now I want to get all respondents by using following web api method but i am not getting correct result set and it is showing null values for Provider and requester and only returning respondent id.
public IQueryable<Respondent> GetRespondents()
{
return db.Respondents;
}