mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-22 20:13:50 +08:00
Replacing some left over hard coded content type strings with their *Driver.ContentType.Name references. Fixing for "blogpost", "comment", " page", and "user"
This commit is contained in:
@@ -5,6 +5,7 @@ using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Common.Records;
|
||||
using Orchard.Data;
|
||||
using Orchard.Blogs.Controllers;
|
||||
|
||||
namespace Orchard.Blogs.Models {
|
||||
[UsedImplicitly]
|
||||
@@ -27,7 +28,7 @@ namespace Orchard.Blogs.Models {
|
||||
//INFO: (erikpo) Get all blog posts for the current blog
|
||||
var postsQuery =
|
||||
from bpr in commonRepository.Table
|
||||
where bpr.ContentItemRecord.ContentType.Name == "blogpost" && bpr.Container.Id == blogPost.Blog.Record.Id
|
||||
where bpr.ContentItemRecord.ContentType.Name == BlogPostDriver.ContentType.Name && bpr.Container.Id == blogPost.Blog.Record.Id
|
||||
orderby bpr.PublishedUtc
|
||||
select bpr;
|
||||
|
||||
|
@@ -101,7 +101,7 @@ namespace Orchard.Comments.Services {
|
||||
}
|
||||
|
||||
public Comment CreateComment(CreateCommentContext context) {
|
||||
var comment = _contentManager.Create<Comment>("comment");
|
||||
var comment = _contentManager.Create<Comment>(CommentDriver.ContentType.Name);
|
||||
|
||||
comment.Record.Author = context.Author;
|
||||
comment.Record.CommentDateUtc = _clock.UtcNow;
|
||||
|
@@ -108,7 +108,7 @@ namespace Orchard.Pages.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditPages, T("Not allowed to create a page")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var page = Services.ContentManager.BuildEditorModel(Services.ContentManager.New<Page>("page"));
|
||||
var page = Services.ContentManager.BuildEditorModel(Services.ContentManager.New<Page>(PageDriver.ContentType.Name));
|
||||
|
||||
var model = new PageCreateViewModel {
|
||||
Page = page
|
||||
@@ -123,7 +123,7 @@ namespace Orchard.Pages.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
// Validate form input
|
||||
var page = Services.ContentManager.New<Page>("page");
|
||||
var page = Services.ContentManager.New<Page>(PageDriver.ContentType.Name);
|
||||
model.Page = Services.ContentManager.UpdateEditorModel(page, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Pages.Controllers;
|
||||
using Orchard.Pages.Models;
|
||||
using Orchard.Core.Common.Records;
|
||||
using Orchard.ContentManagement;
|
||||
@@ -42,7 +43,7 @@ namespace Orchard.Pages.Services {
|
||||
|
||||
public Page Get(string slug) {
|
||||
return
|
||||
_contentManager.Query("page").Join<RoutableRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
|
||||
_contentManager.Query(PageDriver.ContentType.Name).Join<RoutableRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
|
||||
().As<Page>();
|
||||
}
|
||||
|
||||
@@ -52,7 +53,7 @@ namespace Orchard.Pages.Services {
|
||||
|
||||
public Page GetLatest(string slug) {
|
||||
return
|
||||
_contentManager.Query(VersionOptions.Latest, "page").Join<RoutableRecord>().Where(rr => rr.Slug == slug)
|
||||
_contentManager.Query(VersionOptions.Latest, PageDriver.ContentType.Name).Join<RoutableRecord>().Where(rr => rr.Slug == slug)
|
||||
.Slice(0, 1).FirstOrDefault().As<Page>();
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,7 @@ namespace Orchard.Sandbox.Controllers {
|
||||
return RedirectToAction("index");
|
||||
}
|
||||
|
||||
var page = Services.ContentManager.Create<SandboxPage>("sandboxpage", item => {
|
||||
var page = Services.ContentManager.Create<SandboxPage>(SandboxPageDriver.ContentType.Name, item => {
|
||||
item.Record.Name = model.Name;
|
||||
});
|
||||
return RedirectToAction("show", new { page.ContentItem.Id });
|
||||
|
@@ -7,6 +7,7 @@ using Orchard.Data;
|
||||
using Orchard.Logging;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Security;
|
||||
using Orchard.Users.Controllers;
|
||||
using Orchard.Users.Models;
|
||||
|
||||
namespace Orchard.Users.Services {
|
||||
@@ -31,7 +32,8 @@ namespace Orchard.Users.Services {
|
||||
public IUser CreateUser(CreateUserParams createUserParams) {
|
||||
Logger.Information("CreateUser {0} {1}", createUserParams.Username, createUserParams.Email);
|
||||
|
||||
return _contentManager.Create<User>("user", init => {
|
||||
return _contentManager.Create<User>(UserDriver.ContentType.Name, init =>
|
||||
{
|
||||
init.Record.UserName = createUserParams.Username;
|
||||
init.Record.Email = createUserParams.Email;
|
||||
SetPassword(init.Record, createUserParams.Password);
|
||||
|
Reference in New Issue
Block a user