S
shapper
Hello,
I have the following Linq query:
viewData.TagsPapers = (from t in database.Tags
select new TagPaper {
Tag = t,
Extra = new TagExtra
{
FileCount =
t.FilesTags.Count,
PostCount =
t.PostsTags.Count,
}}).ToList();
Given a variable named Source that can have two values "File" or
"Post" I would like to:
1. Order the records by FileCount or PostCount if Source is "File" or
"Post"
2. Get only the records where FileCount != 0 or PostCount != 0 if
Source is "File" or "Post"
Should I use two different queries?
In any case, I need help with the Order (1) and Where (2) problems.
Thanks,
Miguel
I have the following Linq query:
viewData.TagsPapers = (from t in database.Tags
select new TagPaper {
Tag = t,
Extra = new TagExtra
{
FileCount =
t.FilesTags.Count,
PostCount =
t.PostsTags.Count,
}}).ToList();
Given a variable named Source that can have two values "File" or
"Post" I would like to:
1. Order the records by FileCount or PostCount if Source is "File" or
"Post"
2. Get only the records where FileCount != 0 or PostCount != 0 if
Source is "File" or "Post"
Should I use two different queries?
In any case, I need help with the Order (1) and Where (2) problems.
Thanks,
Miguel