public static ContentItem GetContentItem(OxiteCMSDataContext context, Guid siteID, Guid pageID, string name) { return(( from ci in context.oxite_CMS_ContentItems where ci.SiteID == siteID && ci.PageID == pageID && string.Compare(ci.ContentItemName, name, true) == 0 select SqlServerContentItemRepository.ProjectContentItem(context, ci) ).FirstOrDefault()); }
public IQueryable <ContentItem> GetContentItems(Guid siteID, Guid pageID) { return (from ci in context.oxite_CMS_ContentItems group ci.Version by new { ContentItemName = ci.ContentItemName, PageIDHasValue = ci.PageID.HasValue, PageIDValue = ci.PageID.Value } into results join ci in context.oxite_CMS_ContentItems on new { ContentItemName = results.Key.ContentItemName, PageIDHasValue = results.Key.PageIDHasValue, PageIDValue = results.Key.PageIDValue, Version = results.Max() } equals new { ContentItemName = ci.ContentItemName, PageIDHasValue = ci.PageID.HasValue, PageIDValue = ci.PageID.Value, Version = ci.Version } where ci.SiteID == siteID && ci.PageID == pageID select SqlServerContentItemRepository.ProjectContentItem(context, ci)); }