mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 05:23:33 +08:00
Changing page delete action to use the id instead of slug
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045805
This commit is contained in:
@@ -220,11 +220,11 @@ namespace Orchard.Pages.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Delete(string pageSlug) {
|
public ActionResult Delete(int id) {
|
||||||
if (!_services.Authorizer.Authorize(Permissions.DeletePages, T("Couldn't delete page")))
|
if (!_services.Authorizer.Authorize(Permissions.DeletePages, T("Couldn't delete page")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
Page page = _pageService.Get(pageSlug);
|
Page page = _pageService.Get(id);
|
||||||
|
|
||||||
if (page == null)
|
if (page == null)
|
||||||
return new NotFoundResult();
|
return new NotFoundResult();
|
||||||
|
@@ -7,6 +7,7 @@ namespace Orchard.Pages.Services {
|
|||||||
IEnumerable<Page> Get();
|
IEnumerable<Page> Get();
|
||||||
IEnumerable<Page> Get(PageStatus status);
|
IEnumerable<Page> Get(PageStatus status);
|
||||||
Page Get(string slug);
|
Page Get(string slug);
|
||||||
|
Page Get(int id);
|
||||||
Page GetPageOrDraft(string slug);
|
Page GetPageOrDraft(string slug);
|
||||||
Page GetPageOrDraft(int id);
|
Page GetPageOrDraft(int id);
|
||||||
Page GetLatest(string slug);
|
Page GetLatest(string slug);
|
||||||
|
@@ -38,6 +38,10 @@ namespace Orchard.Pages.Services {
|
|||||||
return contentItems.Select(ci => ci.As<Page>());
|
return contentItems.Select(ci => ci.As<Page>());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Page Get(int id) {
|
||||||
|
return _contentManager.Get<Page>(id);
|
||||||
|
}
|
||||||
|
|
||||||
public Page Get(string slug) {
|
public Page Get(string slug) {
|
||||||
return
|
return
|
||||||
_contentManager.Query("page").Join<RoutableRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
|
_contentManager.Query("page").Join<RoutableRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
|
||||||
|
Reference in New Issue
Block a user