diff --git a/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogPostService.cs b/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogPostService.cs index 5a976ca8e..93d068e5a 100644 --- a/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogPostService.cs +++ b/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogPostService.cs @@ -17,15 +17,15 @@ namespace Orchard.Blogs.Services { public BlogPost Get(Blog blog, string slug) { return _contentManager.Query() - .Join().Where(x => x.Slug == slug) - .Join().Where(x => x.Container == blog.Record.ContentItemRecord) + .Join().Where(rr => rr.Slug == slug) + .Join().Where(cr => cr.Container == blog.Record.ContentItemRecord) .List().FirstOrDefault(); } public IEnumerable Get(Blog blog) { return _contentManager.Query() - .Join().Where(x => x.Container == blog.Record.ContentItemRecord) - .OrderByDescending(x=>x.CreatedUtc) + .Join().Where(cr => cr.Container == blog.Record.ContentItemRecord) + .OrderByDescending(cr => cr.CreatedUtc) .List(); } diff --git a/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogService.cs b/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogService.cs index ac9fc5587..52a37376c 100644 --- a/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogService.cs +++ b/src/Orchard.Web/Packages/Orchard.Blogs/Services/BlogService.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.Linq; using Orchard.Blogs.Models; -using Orchard.Core.Common.Models; using Orchard.Core.Common.Records; using Orchard.Data; using Orchard.Models; @@ -19,15 +18,16 @@ namespace Orchard.Blogs.Services { } public Blog Get(string slug) { - RoutableRecord record = _routableRepository.Get(r => r.ContentItemRecord.ContentType.Name == "blog" && r.Slug == slug); - - return record != null ?_contentManager.Get(record.Id) : null; + return _contentManager.Query() + .Join().Where(rr => rr.Slug == slug) + .List().FirstOrDefault(); } public IEnumerable Get() { - IEnumerable records = _routableRepository.Fetch(rr => rr.ContentItemRecord.ContentType.Name == "blog", rr => rr.Asc(rr2 => rr2.Title)); - - return records.Select(rr => _contentManager.Get(rr.Id)); + return _contentManager.Query() + .Join() + .OrderBy(br => br.Title) + .List(); } public void Delete(Blog blog) {