- Removed Orchard.Mvc.NotFoundResult, replaced by the new MVC HttpNotFoundViewResult

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-10-14 11:30:58 -07:00
parent dc5cc339a7
commit dd53923130
17 changed files with 65 additions and 95 deletions

View File

@@ -17,7 +17,6 @@ using Orchard.Core.Feeds.Models;
using Orchard.Core.Feeds.Rss; using Orchard.Core.Feeds.Rss;
using Orchard.Core.Feeds.StandardBuilders; using Orchard.Core.Feeds.StandardBuilders;
using Orchard.Core.Routable.Models; using Orchard.Core.Routable.Models;
using Orchard.Mvc.Results;
using Orchard.Tests.Modules; using Orchard.Tests.Modules;
using Orchard.Tests.Stubs; using Orchard.Tests.Stubs;
@@ -36,7 +35,7 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
var result = controller.Index("no-such-format"); var result = controller.Index("no-such-format");
Assert.That(result, Is.Not.Null); Assert.That(result, Is.Not.Null);
Assert.That(result, Is.TypeOf<NotFoundResult>()); Assert.That(result, Is.TypeOf<HttpNotFoundResult>());
} }
[Test] [Test]

View File

@@ -15,7 +15,6 @@ using Orchard.Data;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Mvc.Results;
using Orchard.UI.Notify; using Orchard.UI.Notify;
namespace Orchard.Core.Contents.Controllers { namespace Orchard.Core.Contents.Controllers {
@@ -47,7 +46,7 @@ namespace Orchard.Core.Contents.Controllers {
public ActionResult List(ListContentsViewModel model) { public ActionResult List(ListContentsViewModel model) {
if (model.ContainerId != null && _contentManager.GetLatest((int)model.ContainerId) == null) if (model.ContainerId != null && _contentManager.GetLatest((int)model.ContainerId) == null)
return new NotFoundResult(); return HttpNotFound();
const int pageSize = 20; const int pageSize = 20;
var skip = (Math.Max(model.Page ?? 0, 1) - 1) * pageSize; var skip = (Math.Max(model.Page ?? 0, 1) - 1) * pageSize;
@@ -57,7 +56,7 @@ namespace Orchard.Core.Contents.Controllers {
if (!string.IsNullOrEmpty(model.TypeName)) { if (!string.IsNullOrEmpty(model.TypeName)) {
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.TypeName); var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.TypeName);
if (contentTypeDefinition == null) if (contentTypeDefinition == null)
return new NotFoundResult(); return HttpNotFound();
model.TypeDisplayName = !string.IsNullOrWhiteSpace(contentTypeDefinition.DisplayName) model.TypeDisplayName = !string.IsNullOrWhiteSpace(contentTypeDefinition.DisplayName)
? contentTypeDefinition.DisplayName ? contentTypeDefinition.DisplayName
@@ -249,7 +248,7 @@ namespace Orchard.Core.Contents.Controllers {
var contentItem = _contentManager.Get(id, VersionOptions.Latest); var contentItem = _contentManager.Get(id, VersionOptions.Latest);
if (contentItem == null) if (contentItem == null)
return new NotFoundResult(); return HttpNotFound();
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Cannot edit content"))) if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Cannot edit content")))
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
@@ -264,7 +263,7 @@ namespace Orchard.Core.Contents.Controllers {
var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired); var contentItem = _contentManager.Get(id, VersionOptions.DraftRequired);
if (contentItem == null) if (contentItem == null)
return new NotFoundResult(); return HttpNotFound();
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Couldn't edit content"))) if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Couldn't edit content")))
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
@@ -313,7 +312,7 @@ namespace Orchard.Core.Contents.Controllers {
public ActionResult Publish(int id, string returnUrl) { public ActionResult Publish(int id, string returnUrl) {
var contentItem = _contentManager.GetLatest(id); var contentItem = _contentManager.GetLatest(id);
if (contentItem == null) if (contentItem == null)
return new NotFoundResult(); return HttpNotFound();
if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't publish content"))) if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't publish content")))
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
@@ -332,7 +331,7 @@ namespace Orchard.Core.Contents.Controllers {
public ActionResult Unpublish(int id, string returnUrl) { public ActionResult Unpublish(int id, string returnUrl) {
var contentItem = _contentManager.GetLatest(id); var contentItem = _contentManager.GetLatest(id);
if (contentItem == null) if (contentItem == null)
return new NotFoundResult(); return HttpNotFound();
if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't unpublish content"))) if (!Services.Authorizer.Authorize(Permissions.PublishContent, contentItem, T("Couldn't unpublish content")))
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();

View File

@@ -3,8 +3,6 @@ using System.Linq;
using System.Web.Mvc; using System.Web.Mvc;
using Orchard.Core.Feeds.Models; using Orchard.Core.Feeds.Models;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Mvc.Results;
using Orchard.Themes;
namespace Orchard.Core.Feeds.Controllers { namespace Orchard.Core.Feeds.Controllers {
public class FeedController : Controller { public class FeedController : Controller {
@@ -34,7 +32,7 @@ namespace Orchard.Core.Feeds.Controllers {
.FirstOrDefault(); .FirstOrDefault();
if (bestFormatterMatch == null || bestFormatterMatch.FeedBuilder == null) if (bestFormatterMatch == null || bestFormatterMatch.FeedBuilder == null)
return new NotFoundResult(); return HttpNotFound();
context.Builder = bestFormatterMatch.FeedBuilder; context.Builder = bestFormatterMatch.FeedBuilder;
@@ -45,7 +43,7 @@ namespace Orchard.Core.Feeds.Controllers {
.FirstOrDefault(); .FirstOrDefault();
if (bestQueryMatch == null || bestQueryMatch.FeedQuery == null) if (bestQueryMatch == null || bestQueryMatch.FeedQuery == null)
return new NotFoundResult(); return HttpNotFound();
return context.Builder.Process(context, () => { return context.Builder.Process(context, () => {
bestQueryMatch.FeedQuery.Execute(context); bestQueryMatch.FeedQuery.Execute(context);

View File

@@ -10,7 +10,6 @@ using Orchard.Core.Routable.Models;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Localization.Services; using Orchard.Localization.Services;
using Orchard.Mvc.Results;
using Orchard.UI.Notify; using Orchard.UI.Notify;
namespace Orchard.Core.Localization.Controllers { namespace Orchard.Core.Localization.Controllers {
@@ -43,7 +42,7 @@ namespace Orchard.Core.Localization.Controllers {
// only support translations from the site culture, at the moment at least // only support translations from the site culture, at the moment at least
if (contentItem == null) if (contentItem == null)
return new NotFoundResult(); return HttpNotFound();
if (!contentItem.Is<LocalizationPart>() || contentItem.As<LocalizationPart>().MasterContentItem != null) { if (!contentItem.Is<LocalizationPart>() || contentItem.As<LocalizationPart>().MasterContentItem != null) {
var metadata = _contentManager.GetItemMetadata(contentItem); var metadata = _contentManager.GetItemMetadata(contentItem);
@@ -79,7 +78,7 @@ namespace Orchard.Core.Localization.Controllers {
var contentItem = _contentManager.Get(id, VersionOptions.Latest); var contentItem = _contentManager.Get(id, VersionOptions.Latest);
if (contentItem == null) if (contentItem == null)
return new NotFoundResult(); return HttpNotFound();
var model = new AddLocalizationViewModel(); var model = new AddLocalizationViewModel();
TryUpdateModel(model); TryUpdateModel(model);

View File

@@ -3,7 +3,6 @@ using JetBrains.Annotations;
using Orchard.Core.Routable.Models; using Orchard.Core.Routable.Models;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.Services; using Orchard.Services;
using Orchard.ContentManagement; using Orchard.ContentManagement;
@@ -35,7 +34,7 @@ namespace Orchard.Core.Routable.Services {
public ActionResult GetHomePage(int itemId) { public ActionResult GetHomePage(int itemId) {
var contentItem = _contentManager.Get(itemId, VersionOptions.Published); var contentItem = _contentManager.Get(itemId, VersionOptions.Published);
if (contentItem == null || !contentItem.Is<RoutePart>()) if (contentItem == null || !contentItem.Is<RoutePart>())
return new NotFoundResult(); return new HttpNotFoundResult();
var model = _contentManager.BuildDisplay(contentItem); var model = _contentManager.BuildDisplay(contentItem);

View File

@@ -9,7 +9,6 @@ using Orchard.ContentManagement.Aspects;
using Orchard.Data; using Orchard.Data;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.UI.Admin; using Orchard.UI.Admin;
using Orchard.UI.Notify; using Orchard.UI.Notify;
@@ -50,7 +49,7 @@ namespace Orchard.Blogs.Controllers {
var blog = Services.ContentManager.New<BlogPart>("Blog"); var blog = Services.ContentManager.New<BlogPart>("Blog");
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.BuildEditor(blog); var model = Services.ContentManager.BuildEditor(blog);
return View(model); return View(model);
@@ -86,7 +85,7 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.BuildEditor(blog); var model = Services.ContentManager.BuildEditor(blog);
return View(model); return View(model);
@@ -100,7 +99,7 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.UpdateEditor(blog, this); var model = Services.ContentManager.UpdateEditor(blog, this);
if (!ModelState.IsValid) if (!ModelState.IsValid)
@@ -120,7 +119,7 @@ namespace Orchard.Blogs.Controllers {
BlogPart blogPart = _blogService.Get(blogSlug); BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null) if (blogPart == null)
return new NotFoundResult(); return HttpNotFound();
_blogService.Delete(blogPart); _blogService.Delete(blogPart);
@@ -147,7 +146,7 @@ namespace Orchard.Blogs.Controllers {
BlogPart blogPart = _blogService.Get(blogSlug); BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null) if (blogPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.BuildDisplay(blogPart, "DetailAdmin"); var model = Services.ContentManager.BuildDisplay(blogPart, "DetailAdmin");
return View(model); return View(model);

View File

@@ -1,4 +1,3 @@
using System;
using System.Linq; using System.Linq;
using System.Web; using System.Web;
using System.Web.Mvc; using System.Web.Mvc;
@@ -10,7 +9,6 @@ using Orchard.Blogs.Services;
using Orchard.Blogs.ViewModels; using Orchard.Blogs.ViewModels;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Logging; using Orchard.Logging;
using Orchard.Mvc.Results;
using Orchard.Themes; using Orchard.Themes;
namespace Orchard.Blogs.Controllers { namespace Orchard.Blogs.Controllers {
@@ -53,11 +51,11 @@ namespace Orchard.Blogs.Controllers {
var correctedSlug = _blogSlugConstraint.FindSlug(blogSlug); var correctedSlug = _blogSlugConstraint.FindSlug(blogSlug);
if (correctedSlug == null) if (correctedSlug == null)
return new NotFoundResult(); return HttpNotFound();
BlogPart blog = _blogService.Get(correctedSlug); BlogPart blog = _blogService.Get(correctedSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var blogPosts = _blogPostService.Get(blog, (page - 1)*pageSize, pageSize).Select(b => _services.ContentManager.BuildDisplay(b, "Summary")); var blogPosts = _blogPostService.Get(blog, (page - 1)*pageSize, pageSize).Select(b => _services.ContentManager.BuildDisplay(b, "Summary"));
@@ -81,7 +79,7 @@ namespace Orchard.Blogs.Controllers {
BlogPart blogPart = _blogService.Get(blogSlug); BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null) if (blogPart == null)
return new NotFoundResult(); return HttpNotFound();
const string manifestUri = "http://schemas.microsoft.com/wlw/manifest/weblog"; const string manifestUri = "http://schemas.microsoft.com/wlw/manifest/weblog";
@@ -106,7 +104,7 @@ namespace Orchard.Blogs.Controllers {
BlogPart blogPart = _blogService.Get(blogSlug); BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null) if (blogPart == null)
return new NotFoundResult(); return HttpNotFound();
const string manifestUri = "http://archipelago.phrasewise.com/rsd"; const string manifestUri = "http://archipelago.phrasewise.com/rsd";

View File

@@ -6,7 +6,6 @@ using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects; using Orchard.ContentManagement.Aspects;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.AntiForgery; using Orchard.Mvc.AntiForgery;
using Orchard.Mvc.Results;
using Orchard.UI.Admin; using Orchard.UI.Admin;
using Orchard.UI.Notify; using Orchard.UI.Notify;
@@ -32,7 +31,7 @@ namespace Orchard.Blogs.Controllers {
var blogPost = Services.ContentManager.New<BlogPostPart>("BlogPost"); var blogPost = Services.ContentManager.New<BlogPostPart>("BlogPost");
if (blogPost.BlogPart == null) if (blogPost.BlogPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.BuildEditor(blogPost); var model = Services.ContentManager.BuildEditor(blogPost);
@@ -46,7 +45,7 @@ namespace Orchard.Blogs.Controllers {
var blogPost = Services.ContentManager.New<BlogPostPart>("BlogPost"); var blogPost = Services.ContentManager.New<BlogPostPart>("BlogPost");
if (blogPost.BlogPart == null) if (blogPost.BlogPart == null)
return new NotFoundResult(); return HttpNotFound();
Services.ContentManager.Create(blogPost, VersionOptions.Draft); Services.ContentManager.Create(blogPost, VersionOptions.Draft);
var model = Services.ContentManager.UpdateEditor(blogPost, this); var model = Services.ContentManager.UpdateEditor(blogPost, this);
@@ -71,11 +70,11 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var post = _blogPostService.Get(postId, VersionOptions.Latest); var post = _blogPostService.Get(postId, VersionOptions.Latest);
if (post == null) if (post == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.BuildEditor(post); var model = Services.ContentManager.BuildEditor(post);
@@ -89,12 +88,12 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
// Get draft (create a new version if needed) // Get draft (create a new version if needed)
var blogPost = _blogPostService.Get(postId, VersionOptions.DraftRequired); var blogPost = _blogPostService.Get(postId, VersionOptions.DraftRequired);
if (blogPost == null) if (blogPost == null)
return new NotFoundResult(); return HttpNotFound();
// Validate form input // Validate form input
var model = Services.ContentManager.UpdateEditor(blogPost, this); var model = Services.ContentManager.UpdateEditor(blogPost, this);
@@ -142,7 +141,7 @@ namespace Orchard.Blogs.Controllers {
ActionResult RedirectToEdit(IContent item) { ActionResult RedirectToEdit(IContent item) {
if (item == null || item.As<BlogPostPart>() == null) if (item == null || item.As<BlogPostPart>() == null)
return new NotFoundResult(); return HttpNotFound();
return RedirectToAction("Edit", new { BlogSlug = item.As<BlogPostPart>().BlogPart.Slug, PostId = item.ContentItem.Id }); return RedirectToAction("Edit", new { BlogSlug = item.As<BlogPostPart>().BlogPart.Slug, PostId = item.ContentItem.Id });
} }
@@ -154,11 +153,11 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var post = _blogPostService.Get(postId, VersionOptions.Latest); var post = _blogPostService.Get(postId, VersionOptions.Latest);
if (post == null) if (post == null)
return new NotFoundResult(); return HttpNotFound();
_blogPostService.Delete(post); _blogPostService.Delete(post);
Services.Notifier.Information(T("Blog post was successfully deleted")); Services.Notifier.Information(T("Blog post was successfully deleted"));
@@ -173,11 +172,11 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var post = _blogPostService.Get(postId, VersionOptions.Latest); var post = _blogPostService.Get(postId, VersionOptions.Latest);
if (post == null) if (post == null)
return new NotFoundResult(); return HttpNotFound();
_blogPostService.Publish(post); _blogPostService.Publish(post);
Services.Notifier.Information(T("Blog post successfully published.")); Services.Notifier.Information(T("Blog post successfully published."));
@@ -192,11 +191,11 @@ namespace Orchard.Blogs.Controllers {
var blog = _blogService.Get(blogSlug); var blog = _blogService.Get(blogSlug);
if (blog == null) if (blog == null)
return new NotFoundResult(); return HttpNotFound();
var post = _blogPostService.Get(postId, VersionOptions.Latest); var post = _blogPostService.Get(postId, VersionOptions.Latest);
if (post == null) if (post == null)
return new NotFoundResult(); return HttpNotFound();
_blogPostService.Unpublish(post); _blogPostService.Unpublish(post);
Services.Notifier.Information(T("Blog post successfully unpublished.")); Services.Notifier.Information(T("Blog post successfully unpublished."));

View File

@@ -7,7 +7,6 @@ using Orchard.ContentManagement;
using Orchard.Core.Feeds; using Orchard.Core.Feeds;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.Security; using Orchard.Security;
using Orchard.Themes; using Orchard.Themes;
@@ -44,12 +43,12 @@ namespace Orchard.Blogs.Controllers {
//TODO: (erikpo) Move looking up the current blog up into a modelbinder //TODO: (erikpo) Move looking up the current blog up into a modelbinder
var blogPart = _blogService.Get(blogSlug); var blogPart = _blogService.Get(blogSlug);
if (blogPart == null) if (blogPart == null)
return new NotFoundResult(); return HttpNotFound();
//TODO: (erikpo) Look up the current user and their permissions to this blog post and determine if they should be able to view it or not. //TODO: (erikpo) Look up the current user and their permissions to this blog post and determine if they should be able to view it or not.
var postPart = _blogPostService.Get(blogPart, postSlug, VersionOptions.Published); var postPart = _blogPostService.Get(blogPart, postSlug, VersionOptions.Published);
if (postPart == null) if (postPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = _services.ContentManager.BuildDisplay(postPart); var model = _services.ContentManager.BuildDisplay(postPart);
@@ -61,7 +60,7 @@ namespace Orchard.Blogs.Controllers {
BlogPart blogPart = _blogService.Get(blogSlug); BlogPart blogPart = _blogService.Get(blogSlug);
if (blogPart == null) if (blogPart == null)
return new NotFoundResult(); return HttpNotFound();
var archive = new ArchiveData(archiveData); var archive = new ArchiveData(archiveData);

View File

@@ -7,7 +7,6 @@ using Orchard.ContentTypes.Services;
using Orchard.ContentTypes.ViewModels; using Orchard.ContentTypes.ViewModels;
using Orchard.Core.Contents.Settings; using Orchard.Core.Contents.Settings;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.UI.Notify; using Orchard.UI.Notify;
namespace Orchard.ContentTypes.Controllers { namespace Orchard.ContentTypes.Controllers {
@@ -72,7 +71,7 @@ namespace Orchard.ContentTypes.Controllers {
var typeViewModel = _contentDefinitionService.GetType(id); var typeViewModel = _contentDefinitionService.GetType(id);
if (typeViewModel == null) if (typeViewModel == null)
return new NotFoundResult(); return HttpNotFound();
return View(typeViewModel); return View(typeViewModel);
} }
@@ -85,7 +84,7 @@ namespace Orchard.ContentTypes.Controllers {
var typeViewModel = _contentDefinitionService.GetType(id); var typeViewModel = _contentDefinitionService.GetType(id);
if (typeViewModel == null) if (typeViewModel == null)
return new NotFoundResult(); return HttpNotFound();
if (!TryUpdateModel(typeViewModel)) if (!TryUpdateModel(typeViewModel))
return View(typeViewModel); return View(typeViewModel);
@@ -109,7 +108,7 @@ namespace Orchard.ContentTypes.Controllers {
var typeViewModel = _contentDefinitionService.GetType(id); var typeViewModel = _contentDefinitionService.GetType(id);
if (typeViewModel == null) if (typeViewModel == null)
return new NotFoundResult(); return HttpNotFound();
var viewModel = new AddPartsViewModel { var viewModel = new AddPartsViewModel {
Type = typeViewModel, Type = typeViewModel,
@@ -129,7 +128,7 @@ namespace Orchard.ContentTypes.Controllers {
var typeViewModel = _contentDefinitionService.GetType(id); var typeViewModel = _contentDefinitionService.GetType(id);
if (typeViewModel == null) if (typeViewModel == null)
return new NotFoundResult(); return HttpNotFound();
var viewModel = new AddPartsViewModel(); var viewModel = new AddPartsViewModel();
if (!TryUpdateModel(viewModel)) if (!TryUpdateModel(viewModel))
@@ -159,7 +158,7 @@ namespace Orchard.ContentTypes.Controllers {
if (typeViewModel == null if (typeViewModel == null
|| !TryUpdateModel(viewModel) || !TryUpdateModel(viewModel)
|| !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name)) || !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
return new NotFoundResult(); return HttpNotFound();
viewModel.Type = typeViewModel; viewModel.Type = typeViewModel;
return View(viewModel); return View(viewModel);
@@ -176,7 +175,7 @@ namespace Orchard.ContentTypes.Controllers {
if (typeViewModel == null if (typeViewModel == null
|| !TryUpdateModel(viewModel) || !TryUpdateModel(viewModel)
|| !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name)) || !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
return new NotFoundResult(); return HttpNotFound();
_contentDefinitionService.RemovePartFromType(viewModel.Name, typeViewModel.Name); _contentDefinitionService.RemovePartFromType(viewModel.Name, typeViewModel.Name);
@@ -230,7 +229,7 @@ namespace Orchard.ContentTypes.Controllers {
var partViewModel = _contentDefinitionService.GetPart(id); var partViewModel = _contentDefinitionService.GetPart(id);
if (partViewModel == null) if (partViewModel == null)
return new NotFoundResult(); return HttpNotFound();
return View(partViewModel); return View(partViewModel);
} }
@@ -243,7 +242,7 @@ namespace Orchard.ContentTypes.Controllers {
var partViewModel = _contentDefinitionService.GetPart(id); var partViewModel = _contentDefinitionService.GetPart(id);
if (partViewModel == null) if (partViewModel == null)
return new NotFoundResult(); return HttpNotFound();
if (!TryUpdateModel(partViewModel)) if (!TryUpdateModel(partViewModel))
return View(partViewModel); return View(partViewModel);
@@ -272,7 +271,7 @@ namespace Orchard.ContentTypes.Controllers {
if (typeViewModel != null) if (typeViewModel != null)
partViewModel = new EditPartViewModel(new ContentPartDefinition(id)); partViewModel = new EditPartViewModel(new ContentPartDefinition(id));
else else
return new NotFoundResult(); return HttpNotFound();
} }
var viewModel = new AddFieldViewModel { var viewModel = new AddFieldViewModel {
@@ -298,7 +297,7 @@ namespace Orchard.ContentTypes.Controllers {
_contentDefinitionService.AddPartToType(partViewModel.Name, typeViewModel.Name); _contentDefinitionService.AddPartToType(partViewModel.Name, typeViewModel.Name);
} }
else { else {
return new NotFoundResult(); return HttpNotFound();
} }
} }
@@ -334,7 +333,7 @@ namespace Orchard.ContentTypes.Controllers {
if (partViewModel == null if (partViewModel == null
|| !TryUpdateModel(viewModel) || !TryUpdateModel(viewModel)
|| !partViewModel.Fields.Any(p => p.Name == viewModel.Name)) || !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
return new NotFoundResult(); return HttpNotFound();
viewModel.Part = partViewModel; viewModel.Part = partViewModel;
return View(viewModel); return View(viewModel);
@@ -351,7 +350,7 @@ namespace Orchard.ContentTypes.Controllers {
if (partViewModel == null if (partViewModel == null
|| !TryUpdateModel(viewModel) || !TryUpdateModel(viewModel)
|| !partViewModel.Fields.Any(p => p.Name == viewModel.Name)) || !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
return new NotFoundResult(); return HttpNotFound();
_contentDefinitionService.RemoveFieldFromPart(viewModel.Name, partViewModel.Name); _contentDefinitionService.RemoveFieldFromPart(viewModel.Name, partViewModel.Name);

View File

@@ -4,8 +4,6 @@ using System.Web.Mvc;
using Orchard.Data.Migration; using Orchard.Data.Migration;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Modules.ViewModels; using Orchard.Modules.ViewModels;
using Orchard.Mvc.Results;
using Orchard.Packaging;
using Orchard.Packaging.Services; using Orchard.Packaging.Services;
using Orchard.Reports.Services; using Orchard.Reports.Services;
using Orchard.UI.Notify; using Orchard.UI.Notify;
@@ -97,7 +95,7 @@ namespace Orchard.Modules.Controllers {
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return new NotFoundResult(); return HttpNotFound();
_moduleService.EnableFeatures(new[] { id }, force != null && (bool)force); _moduleService.EnableFeatures(new[] { id }, force != null && (bool)force);
@@ -110,7 +108,7 @@ namespace Orchard.Modules.Controllers {
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return new NotFoundResult(); return HttpNotFound();
_moduleService.DisableFeatures(new[] { id }, force != null && (bool)force); _moduleService.DisableFeatures(new[] { id }, force != null && (bool)force);
@@ -123,7 +121,7 @@ namespace Orchard.Modules.Controllers {
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
if (string.IsNullOrEmpty(id)) if (string.IsNullOrEmpty(id))
return new NotFoundResult(); return HttpNotFound();
try { try {
_reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation"); _reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation");

View File

@@ -5,7 +5,6 @@ using Orchard.Environment.Configuration;
using Orchard.Localization; using Orchard.Localization;
using Orchard.MultiTenancy.Services; using Orchard.MultiTenancy.Services;
using Orchard.MultiTenancy.ViewModels; using Orchard.MultiTenancy.ViewModels;
using Orchard.Mvc.Results;
using Orchard.UI.Notify; using Orchard.UI.Notify;
namespace Orchard.MultiTenancy.Controllers { namespace Orchard.MultiTenancy.Controllers {
@@ -76,7 +75,7 @@ namespace Orchard.MultiTenancy.Controllers {
var tenant = _tenantService.GetTenants().FirstOrDefault(ss => ss.Name == name); var tenant = _tenantService.GetTenants().FirstOrDefault(ss => ss.Name == name);
if (tenant == null) if (tenant == null)
return new NotFoundResult(); return HttpNotFound();
return View(new TenantEditViewModel { return View(new TenantEditViewModel {
Name = tenant.Name, Name = tenant.Name,
@@ -100,7 +99,7 @@ namespace Orchard.MultiTenancy.Controllers {
var tenant = _tenantService.GetTenants().FirstOrDefault(ss => ss.Name == viewModel.Name); var tenant = _tenantService.GetTenants().FirstOrDefault(ss => ss.Name == viewModel.Name);
if (tenant == null) if (tenant == null)
return new NotFoundResult(); return HttpNotFound();
_tenantService.UpdateTenant( _tenantService.UpdateTenant(
new ShellSettings { new ShellSettings {

View File

@@ -5,7 +5,6 @@ using System.Web.Mvc;
using Orchard.Data.Migration; using Orchard.Data.Migration;
using Orchard.DisplayManagement; using Orchard.DisplayManagement;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.Reports.Services; using Orchard.Reports.Services;
using Orchard.Security; using Orchard.Security;
using Orchard.Themes.Preview; using Orchard.Themes.Preview;
@@ -176,7 +175,7 @@ namespace Orchard.Themes.Controllers {
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
if (string.IsNullOrEmpty(themeName)) if (string.IsNullOrEmpty(themeName))
return new NotFoundResult(); return HttpNotFound();
try { try {
_reportsCoordinator.Register("Data Migration", "Upgrade " + themeName, "Orchard installation"); _reportsCoordinator.Register("Data Migration", "Upgrade " + themeName, "Orchard installation");

View File

@@ -14,7 +14,6 @@ using Orchard.Settings;
using JetBrains.Annotations; using JetBrains.Annotations;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.Users.Models; using Orchard.Users.Models;
using Orchard.Mvc.Results;
namespace Orchard.Users.Controllers { namespace Orchard.Users.Controllers {
[HandleError, Themed] [HandleError, Themed]
@@ -96,7 +95,7 @@ namespace Orchard.Users.Controllers {
// ensure users can register // ensure users can register
var registrationSettings = CurrentSite.As<RegistrationSettingsPart>(); var registrationSettings = CurrentSite.As<RegistrationSettingsPart>();
if ( !registrationSettings.UsersCanRegister ) { if ( !registrationSettings.UsersCanRegister ) {
return new NotFoundResult(); return HttpNotFound();
} }
ViewData["PasswordLength"] = MinPasswordLength; ViewData["PasswordLength"] = MinPasswordLength;
@@ -109,7 +108,7 @@ namespace Orchard.Users.Controllers {
// ensure users can register // ensure users can register
var registrationSettings = CurrentSite.As<RegistrationSettingsPart>(); var registrationSettings = CurrentSite.As<RegistrationSettingsPart>();
if ( !registrationSettings.UsersCanRegister ) { if ( !registrationSettings.UsersCanRegister ) {
return new NotFoundResult(); return HttpNotFound();
} }
ViewData["PasswordLength"] = MinPasswordLength; ViewData["PasswordLength"] = MinPasswordLength;

View File

@@ -5,7 +5,6 @@ using System.Linq;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.Core.Contents.Controllers; using Orchard.Core.Contents.Controllers;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Mvc.Results;
using Orchard.UI.Admin; using Orchard.UI.Admin;
using Orchard.UI.Notify; using Orchard.UI.Notify;
using Orchard.Widgets.Models; using Orchard.Widgets.Models;
@@ -99,7 +98,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
WidgetPart widgetPart = Services.ContentManager.New<WidgetPart>(widgetType); WidgetPart widgetPart = Services.ContentManager.New<WidgetPart>(widgetType);
if (widgetPart == null) if (widgetPart == null)
return new NotFoundResult(); return HttpNotFound();
dynamic model = Services.ContentManager.BuildEditor(widgetPart); dynamic model = Services.ContentManager.BuildEditor(widgetPart);
return View(model); return View(model);
@@ -119,7 +118,7 @@ namespace Orchard.Widgets.Controllers {
int widgetPosition = _widgetsService.GetWidgets(layerId).Count() + 1; int widgetPosition = _widgetsService.GetWidgets(layerId).Count() + 1;
WidgetPart widgetPart = _widgetsService.CreateWidget(layerId, widgetType, "", widgetPosition.ToString(), ""); WidgetPart widgetPart = _widgetsService.CreateWidget(layerId, widgetType, "", widgetPosition.ToString(), "");
if (widgetPart == null) if (widgetPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.UpdateEditor(widgetPart, this); var model = Services.ContentManager.UpdateEditor(widgetPart, this);
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
@@ -143,7 +142,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
LayerPart layerPart = Services.ContentManager.New<LayerPart>("Layer"); LayerPart layerPart = Services.ContentManager.New<LayerPart>("Layer");
if (layerPart == null) if (layerPart == null)
return new NotFoundResult(); return HttpNotFound();
dynamic model = Services.ContentManager.BuildEditor(layerPart); dynamic model = Services.ContentManager.BuildEditor(layerPart);
return View(model); return View(model);
@@ -162,7 +161,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
LayerPart layerPart = _widgetsService.CreateLayer("", "", ""); LayerPart layerPart = _widgetsService.CreateLayer("", "", "");
if (layerPart == null) if (layerPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.UpdateEditor(layerPart, this); var model = Services.ContentManager.UpdateEditor(layerPart, this);
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
@@ -186,7 +185,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
LayerPart layerPart = _widgetsService.GetLayer(id); LayerPart layerPart = _widgetsService.GetLayer(id);
if (layerPart == null) { if (layerPart == null) {
return new NotFoundResult(); return HttpNotFound();
} }
dynamic model = Services.ContentManager.BuildEditor(layerPart); dynamic model = Services.ContentManager.BuildEditor(layerPart);
@@ -207,7 +206,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
LayerPart layerPart = _widgetsService.GetLayer(id); LayerPart layerPart = _widgetsService.GetLayer(id);
if (layerPart == null) if (layerPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.UpdateEditor(layerPart, this); var model = Services.ContentManager.UpdateEditor(layerPart, this);
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
@@ -276,7 +275,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
widgetPart = _widgetsService.GetWidget(id); widgetPart = _widgetsService.GetWidget(id);
if (widgetPart == null) if (widgetPart == null)
return new NotFoundResult(); return HttpNotFound();
var model = Services.ContentManager.UpdateEditor(widgetPart, this); var model = Services.ContentManager.UpdateEditor(widgetPart, this);
if (!ModelState.IsValid) { if (!ModelState.IsValid) {
@@ -305,7 +304,7 @@ namespace Orchard.Widgets.Controllers {
try { try {
widgetPart = _widgetsService.GetWidget(id); widgetPart = _widgetsService.GetWidget(id);
if (widgetPart == null) if (widgetPart == null)
return new NotFoundResult(); return HttpNotFound();
_widgetsService.DeleteWidget(widgetPart.Id); _widgetsService.DeleteWidget(widgetPart.Id);
Services.Notifier.Information(T("Widget was successfully deleted")); Services.Notifier.Information(T("Widget was successfully deleted"));

View File

@@ -1,11 +0,0 @@
using System.Net;
using System.Web;
using System.Web.Mvc;
namespace Orchard.Mvc.Results {
public class NotFoundResult : ViewResult {
public override void ExecuteResult(ControllerContext context) {
throw new HttpException((int)HttpStatusCode.NotFound, "Resource not found");
}
}
}

View File

@@ -757,7 +757,6 @@
<Compile Include="Mvc\ModelBinders\IModelBinderPublisher.cs" /> <Compile Include="Mvc\ModelBinders\IModelBinderPublisher.cs" />
<Compile Include="Mvc\ModelBinders\KeyedListModelBinder.cs" /> <Compile Include="Mvc\ModelBinders\KeyedListModelBinder.cs" />
<Compile Include="Mvc\ModelBinders\ModelBinderDescriptor.cs" /> <Compile Include="Mvc\ModelBinders\ModelBinderDescriptor.cs" />
<Compile Include="Mvc\Results\NotFoundResult.cs" />
<Compile Include="Mvc\Routes\RouteExtensions.cs" /> <Compile Include="Mvc\Routes\RouteExtensions.cs" />
<Compile Include="Mvc\ViewEngines\IViewEngineProvider.cs" /> <Compile Include="Mvc\ViewEngines\IViewEngineProvider.cs" />
<Compile Include="Mvc\ViewEngines\LayoutViewContext.cs" /> <Compile Include="Mvc\ViewEngines\LayoutViewContext.cs" />