hi all
I want to combine 2 queries in in one. I have following code and how will i write LINQ to combine it -
var List = (from m in resellers
select new SelectListItem
{
Text = m.Rr,
Value = m.RrId.ToString(),
Selected = m.rId == cId
}).OrderBy(t => t.Text).ToList();
ViewBag.rrs = List;
How will I send or add above LINQ's output to my 2nd LINQ which is given below -
reportsViewModel.MList = (from m in array //join p in rrs on m equals p.RrId
select new MModel
{
mth = m.Key,
views = m.Value
}).OrderBy(t => rrs).ToList();
I tried to join it but it is giving me an error....
Thanks in advance.... any help is appreciated...

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Dec 18, 2013, 7:05 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Dec 18, 2013, 7:23 PM EST
if you want to add one collection to other collection then both collection must have same type.
so first of all make these two collection have same type and then you can use union to combine this collections.
hope this will help you.
swami swami22 reputationPosted Dec 19, 2013, 5:39 AM EST
VulpesRank #55 · 29.2K reputationPosted Dec 19, 2013, 6:04 AM EST
However, the OrderBy clause looks wrong as your only choices are t.mth or t.views.
swami swami22 reputationPosted Dec 19, 2013, 6:09 AM EST
VulpesRank #55 · 29.2K reputationPosted Dec 19, 2013, 6:19 AM EST
So as long as the types of 'm' and the property, p.RrId, are the same, then the join should work
However, I've just noticed that 'p' doesn't have a property called RrId. The ones it does have are called Text, Value and Selected which appear to be of types string, string and bool respectively.