From 8bbd696ba0ae1178ba5d8b44a9644e7dc15b1ae0 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 15 Nov 2010 17:57:02 -0800 Subject: [PATCH] Fixing Blog remove functionality --HG-- branch : dev --- .../Orchard.Blogs/Controllers/BlogAdminController.cs | 8 ++++---- .../Modules/Orchard.Blogs/Services/BlogService.cs | 6 +++--- .../Modules/Orchard.Blogs/Services/IBlogService.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs index c6e921a9f..3fc132fd4 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogAdminController.cs @@ -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()); diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs index 55d31cb0e..5e127be94 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs @@ -35,9 +35,9 @@ namespace Orchard.Blogs.Services { .List(); } - public void Delete(BlogPart blogPart) { - _contentManager.Remove(blogPart.ContentItem); - _blogSlugConstraint.RemoveSlug(blogPart.As().Path); + public void Delete(ContentItem blog) { + _contentManager.Remove(blog); + _blogSlugConstraint.RemoveSlug(blog.As().Path); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Services/IBlogService.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Services/IBlogService.cs index e944f5030..aa3242d15 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Services/IBlogService.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Services/IBlogService.cs @@ -7,6 +7,6 @@ namespace Orchard.Blogs.Services { BlogPart Get(string slug); ContentItem Get(int id, VersionOptions versionOptions); IEnumerable Get(); - void Delete(BlogPart blogPart); + void Delete(ContentItem blog); } } \ No newline at end of file