mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
Fixing Blog remove functionality
--HG-- branch : dev
This commit is contained in:
@@ -113,16 +113,16 @@ namespace Orchard.Blogs.Controllers {
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Remove(string blogSlug) {
|
||||
public ActionResult Remove(int id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't delete blog")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
BlogPart blogPart = _blogService.Get(blogSlug);
|
||||
var blog = _blogService.Get(id, VersionOptions.Latest);
|
||||
|
||||
if (blogPart == null)
|
||||
if (blog == null)
|
||||
return HttpNotFound();
|
||||
|
||||
_blogService.Delete(blogPart);
|
||||
_blogService.Delete(blog);
|
||||
|
||||
Services.Notifier.Information(T("Blog was successfully deleted"));
|
||||
return Redirect(Url.BlogsForAdmin());
|
||||
|
@@ -35,9 +35,9 @@ namespace Orchard.Blogs.Services {
|
||||
.List();
|
||||
}
|
||||
|
||||
public void Delete(BlogPart blogPart) {
|
||||
_contentManager.Remove(blogPart.ContentItem);
|
||||
_blogSlugConstraint.RemoveSlug(blogPart.As<IRoutableAspect>().Path);
|
||||
public void Delete(ContentItem blog) {
|
||||
_contentManager.Remove(blog);
|
||||
_blogSlugConstraint.RemoveSlug(blog.As<IRoutableAspect>().Path);
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,6 +7,6 @@ namespace Orchard.Blogs.Services {
|
||||
BlogPart Get(string slug);
|
||||
ContentItem Get(int id, VersionOptions versionOptions);
|
||||
IEnumerable<BlogPart> Get();
|
||||
void Delete(BlogPart blogPart);
|
||||
void Delete(ContentItem blog);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user