private Article GetExistingArticle(Guid articleId) { var existingArticle = _context.Query <Article>("MetaTags") .FirstOrDefault(article => article.Id == articleId); return(existingArticle); }
private IQueryable <EntryMedia> GetAllMediaUploadedForArticle(Guid entryId) { return(_context.Query <Article>() .Where(a => a.ArticleEntries.Any(ae => ae.Id == entryId)) .SelectMany(a => a.ArticleEntries) .SelectMany(ae => ae.EntryMedia)); }
public async Task <IQueryable <Article> > Find(Guid blogId) { var allBlogsQuery = _context.Query <Blog>("Articles.MetaTags"); var allBlogArticlesQuery = FilterArticlesForBlog(blogId, allBlogsQuery); var allActiveArticlesQuery = FilterActiveArticles(allBlogArticlesQuery); return(await Task.FromResult(allActiveArticlesQuery)); }
public IEnumerable <string> GetAllTagsForArticle(Guid articleId) { var tags = _context.Query <MetaTag>() .Where(mt => mt.ArticleId == articleId) .Select(mt => mt.Name).ToArray(); return(tags); }
public async Task <EntryContent> FindLatestEntry(Guid articleId) { await Task.CompletedTask; return(_context.Query <Article>() .Where(a => a.Id == articleId) .SelectMany(a => a.ArticleEntries) .Where(ae => ae.Persisted.HasValue) .OrderByDescending(ae => ae.Persisted) .FirstOrDefault()); }