Fixing Blog remove functionality

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-11-15 17:57:02 -08:00
parent 4f1f055377
commit 8bbd696ba0
3 changed files with 8 additions and 8 deletions

View File

@@ -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());

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}