I cant find a way how to do a multiple filtering with LINQ.
what i want to do:
1.Filter the Version(Achieved)
2.Filter down the CompanyName(filtering/removing duplicates)
3.Get the Latest Timestamp
4.Then add all to a List.
Here is so far the code that i have written(which is not working).
public List<ReleaseStatistics> GetReleaseStatistics(IQueryable<InstallationInformation> input, IQueryable<DBContext.Version> mapping)
{
List<ReleaseStatistics> Releasestats = new List<ReleaseStatistics>();
foreach (var version in mapping)
{
IQueryable<InstallationInformation> QueryResult1 = input.Where(x => x.ProductVersion == version.VersionNumber);
IQueryable<InstallationInformation> QueryResult2 = QueryResult1.GroupBy(x => x.CompanyName).SelectMany(y => y);
List<InstallationInformation> ListofInstallationInformation = QueryResult2.ToList<InstallationInformation>();
if (ListofInstallationInformation.Count >= 1)
{
Releasestats.Add(new ReleaseStatistics
{
ReleaseVersion = version.ReleaseName,
CustomerCount = QueryResult1.Where(x => x.ProductVersion == version.VersionNumber).Count()
});
}
}
return Releasestats;
}
Addition information:
One of the problem is that there are duplicate and i want to Filter/remove them, but i want to get the latest timestamp of each CompanyName and then add it to the list.