Hi
In below code i want only Distinct Participant Id
public List
{
try
{
List
where t.TrainingID == ID
select t).ToList();
return Result;
}
catch (Exception ex)
{
throw ex;
}
}
Thanks

Jignesh KumarRank #91 · 22.9K reputationPosted Sep 8, 2022, 2:16 AM EDT
Jignesh KumarRank #91 · 22.9K reputationPosted Sep 8, 2022, 2:09 AM EDT
Rajanikant HawaldarRank #110 · 20.4K reputationPosted Sep 8, 2022, 2:10 AM EDT
Ramco RamcoRank #462 · 5.4K reputationPosted Sep 8, 2022, 2:11 AM EDT
Hi Jignesh
It is giving error Iqueryable TrainingParticipant does not contain a definition for distinctBy
Trying below code but not working
public List GetSelectedUsers(Int32 ID) Result = (from t in context.TrainingParticipants
{
try
{
List
where t.TrainingID == ID
orderby t.ParticipantID select t.ParticipantID).Distinct().ToList();
//select t).Distinct(x => x.ParticipantID).ToList();
return Result;
}
catch (Exception ex)
{
throw ex;
}
}
Thanks
Vishal YelveRank #178 · 13.6K reputationPosted Sep 8, 2022, 2:29 AM EDT