S
shapper
Hello,
I have the following Linq query:
var q = (from p in database.Posts
join pt in database.PostsTags on p.PostID equals
pt.PostID
join t in database.Tags on pt.TagID equals t.TagID
group t by p into pt
select new PostPaper {
Post = pt.Key,
Tags = pt.ToList(),
TagsCSV = pt.Aggregate((a, b) => a.Name + ", " +
b.Name)
}).ToPagedList(page.HasValue ? page.Value - 1 : 0,
ListPageSize);
I am getting an error on the aggregate function:
Cannot implicitly convert type 'string' to 'BonsAlunos.Models.Tag'
Basically, what I am trying to do is build TagsCSV with the Name
property of all tags from Tags list separated by commas ... any idea
of how to do this?
Thanks,
Miguel
I have the following Linq query:
var q = (from p in database.Posts
join pt in database.PostsTags on p.PostID equals
pt.PostID
join t in database.Tags on pt.TagID equals t.TagID
group t by p into pt
select new PostPaper {
Post = pt.Key,
Tags = pt.ToList(),
TagsCSV = pt.Aggregate((a, b) => a.Name + ", " +
b.Name)
}).ToPagedList(page.HasValue ? page.Value - 1 : 0,
ListPageSize);
I am getting an error on the aggregate function:
Cannot implicitly convert type 'string' to 'BonsAlunos.Models.Tag'
Basically, what I am trying to do is build TagsCSV with the Name
property of all tags from Tags list separated by commas ... any idea
of how to do this?
Thanks,
Miguel