2009-11-25 01:34:23 +00:00
|
|
|
using System;
|
2009-12-01 21:04:37 +00:00
|
|
|
using System.Web.Routing;
|
2009-11-25 23:12:19 +00:00
|
|
|
using Orchard.Core.Common.Models;
|
2009-11-20 23:31:49 +00:00
|
|
|
using Orchard.Models;
|
2009-11-25 23:12:19 +00:00
|
|
|
using Orchard.Security;
|
2009-11-20 23:31:49 +00:00
|
|
|
|
|
|
|
namespace Orchard.Blogs.Models {
|
2009-12-01 21:04:37 +00:00
|
|
|
public class BlogPost : ContentPart<BlogPostRecord>, IContentDisplayInfo {
|
2009-11-29 06:08:46 +00:00
|
|
|
public readonly static ContentType ContentType = new ContentType { Name = "blogpost", DisplayName = "Blog Post" };
|
|
|
|
|
2009-11-26 00:41:00 +00:00
|
|
|
public Blog Blog { get; set; }
|
2009-12-01 20:24:18 +00:00
|
|
|
public int Id { get { return ContentItem.Id; } }
|
2009-11-25 23:12:19 +00:00
|
|
|
public string Title { get { return this.As<RoutableAspect>().Title; } }
|
2009-12-01 05:30:10 +00:00
|
|
|
public string Body { get { return this.As<BodyAspect>().Record.Text; } }
|
2009-11-25 23:12:19 +00:00
|
|
|
public string Slug { get { return this.As<RoutableAspect>().Slug; } }
|
|
|
|
public IUser Creator { get { return this.As<CommonAspect>().OwnerField.Value; } }
|
2009-11-25 01:34:23 +00:00
|
|
|
public DateTime? Published { get { return Record.Published; } }
|
2009-12-01 21:04:37 +00:00
|
|
|
|
|
|
|
#region IContentDisplayInfo Members
|
|
|
|
|
|
|
|
public string DisplayText {
|
|
|
|
get { return Title; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public RouteValueDictionary DisplayRouteValues() {
|
|
|
|
return new RouteValueDictionary(new { area = "Orchard.Blogs", controller = "BlogPost", action = "Item", blogSlug = Blog.Slug, postSlug = Slug });
|
|
|
|
}
|
|
|
|
|
|
|
|
public RouteValueDictionary EditRouteValues() {
|
2009-12-01 22:00:43 +00:00
|
|
|
return new RouteValueDictionary(new { area = "Orchard.Blogs", controller = "BlogPost", action = "Edit", blogSlug = Blog.Slug, postSlug = Slug });
|
2009-12-01 21:04:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
2009-11-20 23:31:49 +00:00
|
|
|
}
|
|
|
|
}
|