Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lee 1130 posts 3088 karma points
    Mar 03, 2011 @ 08:53
    Lee
    0

    Convert L2U Queries In Razor?

    Looking for some expert advice from you guys, I am going to be attempting to port an L2U solution over to Razor and change the queries... I have a query that I'd like to get your advice on how you would attempt to write it.

                    var u = MyUmbracoDataContext.Instance;
    
    
                    // Get the lastest 30 posts from this user
                    var posts = (from p in u.ForumPosts
                                 where p.ForumPostOwnedBy == CurrentMember.MemberId
                                 select p.ParentNodeId).Distinct().Take(30);
    
                    // Now get topics where the user has posted
                    var maintopics = from t in u.ForumTopics
                                      where posts.Contains(t.Id)
                                      orderby t.ForumTopicLastPost descending
                                      select t;
    
                    // Now bind
                    rptTopicList.DataSource = maintopics;
                    rptTopicList.DataBind();
Please Sign in or register to post replies

Write your reply to:

Draft