2009-11-25 01:34:23 +00:00
|
|
|
using System;
|
2009-12-09 23:07:00 +00:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
using System.Web.Mvc;
|
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-02 02:24:39 +00:00
|
|
|
public class BlogPost : ContentPart<BlogPostRecord> {
|
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-09 23:07:00 +00:00
|
|
|
|
|
|
|
[HiddenInput(DisplayValue = false)]
|
2009-12-01 20:24:18 +00:00
|
|
|
public int Id { get { return ContentItem.Id; } }
|
2009-12-09 23:07:00 +00:00
|
|
|
|
|
|
|
[Required]
|
2009-12-10 00:03:10 +00:00
|
|
|
public string Title {
|
|
|
|
get { return this.As<RoutableAspect>().Title; }
|
|
|
|
set { this.As<RoutableAspect>().Record.Title = value; }
|
|
|
|
}
|
2009-12-09 23:07:00 +00:00
|
|
|
|
|
|
|
[Required]
|
2009-12-10 00:03:10 +00:00
|
|
|
public string Slug {
|
|
|
|
get { return this.As<RoutableAspect>().Slug; }
|
|
|
|
set { this.As<RoutableAspect>().Record.Slug = value; }
|
|
|
|
}
|
2009-12-09 23:07:00 +00:00
|
|
|
|
|
|
|
[Required]
|
2009-12-10 00:03:10 +00:00
|
|
|
public string Body {
|
|
|
|
get { return this.As<BodyAspect>().Record.Text; }
|
|
|
|
set { this.As<BodyAspect>().Record.Text = value; }
|
|
|
|
}
|
2009-12-09 23:07:00 +00:00
|
|
|
|
2009-12-10 00:03:10 +00:00
|
|
|
public IUser Creator {
|
|
|
|
get { return this.As<CommonAspect>().OwnerField.Value; }
|
|
|
|
set { this.As<CommonAspect>().Record.OwnerId = value.Id; }
|
|
|
|
}
|
2009-12-09 23:07:00 +00:00
|
|
|
|
|
|
|
public DateTime? Published
|
|
|
|
{
|
|
|
|
get { return Record.Published; }
|
|
|
|
set { Record.Published = value; }
|
|
|
|
}
|
2009-11-20 23:31:49 +00:00
|
|
|
}
|
|
|
|
}
|