public class UserController : ApiController
{
UserSampleEntities entities = new UserSampleEntities();
// GET api/<controller>
[Route("api/User")]
public IEnumerable<user> Get()
{
{
return entities.users;
}
}
}
This returns the json with all the entries in the database with all its properties. How do I filter such that I can obtain a json for only specific properties?
DistinctBy?? , LinQ only hasEnumerable.Distinct Method. And what is this Select overload learn.microsoft.com/en-us/dotnet/api/…? Does this compile?IEnumerable<user>. I expect element fromentities.usersto be type ofuser. So what are you trying to return as object new user with only some poperties initialise so perhapsSelect(x=> new user{prop1= x.Prop1})? or are you trying to select like this : Select Multiple Fields from List in Linq