mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 05:23:33 +08:00
Initial check in of some code that shows a list of blogs, a blog details page and can create a blog.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4041601
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Mvc.Results;
|
||||
|
||||
namespace Orchard.Blogs.Controllers {
|
||||
public class BlogController : Controller {
|
||||
private readonly IBlogService _blogService;
|
||||
|
||||
public BlogController(IBlogService blogService) {
|
||||
_blogService = blogService;
|
||||
}
|
||||
|
||||
public ActionResult List() {
|
||||
return View(_blogService.Get());
|
||||
}
|
||||
|
||||
//TODO: (erikpo) Should think about moving the slug parameter and get call and null check up into a model binder or action filter
|
||||
public ActionResult Item(string slug) {
|
||||
Blog blog = _blogService.Get(slug);
|
||||
|
||||
if (blog == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
return View(blog);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user