public IEnumerable <Post> GetPostsByMonth(DateTime monthYear) { var fromDate = new DateTime(monthYear.Year, monthYear.Month, 1); var toDate = fromDate.AddMonths(1).AddDays(-1); return(MyDbSet.Where(p => p.PostedOn >= fromDate && p.PostedOn <= toDate).ToList()); }
public IQueryable <Flower> GetByCategory(int categoryId) { return(MyDbSet.Where(p => p.Category.CategoryId == categoryId).OrderByDescending(p => p.CategoryId)); }
public IEnumerable <Post> GetLatestPost(int size) { return(MyDbSet.Where(p => p.Published).OrderByDescending(p => p.PostedOn).Take(size).ToList()); }
public IEnumerable <Post> GetUnpublisedPosts() { return(MyDbSet.Where(p => !p.Published).OrderByDescending(p => p.Modified).ToList()); }
public IQueryable <Post> GetPostsByTag(string tag) { return(MyDbSet.Where(p => p.Tags.Any(t => t.UrlSlug == tag)).OrderByDescending(p => p.PostedOn)); }
public IQueryable <Post> GetPostsByCategory(string category) { return(MyDbSet.Where(p => p.Category.Name == category).OrderByDescending(p => p.PostedOn)); }
public IEnumerable <Post> GetMostViewedPost(int size) { return(MyDbSet.Where(p => p.Published).OrderByDescending(p => p.ViewCount).Take(size).ToList()); }