Files
OurUmbraco/uForum/Models/Topic.cs
T

72 lines
1.8 KiB
C#
Raw Normal View History

2015-01-19 22:00:10 +01:00
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2015-01-26 13:13:06 +01:00
using umbraco;
using Umbraco.Core.Persistence;
2015-01-19 22:00:10 +01:00
namespace uForum.Models
{
2015-01-26 13:13:06 +01:00
[TableName("forumTopics")]
[PrimaryKey("id")]
[ExplicitColumns]
2015-01-19 22:00:10 +01:00
public class Topic
{
2015-01-26 13:13:06 +01:00
[Column("id")]
2015-01-19 22:00:10 +01:00
public int Id { get; set; }
2015-01-26 13:13:06 +01:00
[Column("parentId")]
2015-01-19 22:00:10 +01:00
public int ParentId { get; set; }
2015-01-26 13:13:06 +01:00
[Column("memberId")]
2015-01-19 22:00:10 +01:00
public int MemberId { get; set; }
2015-01-26 13:13:06 +01:00
[Column("answer")]
2015-01-19 22:00:10 +01:00
public int Answer { get; set; }
2015-01-26 13:13:06 +01:00
[Column("title")]
2015-01-19 22:00:10 +01:00
public string Title { get; set; }
2015-01-26 13:13:06 +01:00
[Column("urlName")]
2015-01-19 22:00:10 +01:00
public string UrlName { get; set; }
2015-01-26 13:13:06 +01:00
[Column("body")]
2015-01-19 22:00:10 +01:00
public string Body { get; set; }
2015-01-26 13:13:06 +01:00
[Column("created")]
2015-01-19 22:00:10 +01:00
public DateTime Created { get; set; }
2015-01-26 13:13:06 +01:00
[Column("updated")]
2015-01-19 22:00:10 +01:00
public DateTime Updated { get; set; }
2015-01-26 13:13:06 +01:00
[Column("isSpam")]
2015-01-19 22:00:10 +01:00
public bool IsSpam { get; set; }
2015-01-26 13:13:06 +01:00
[Column("latestReplyAuthor")]
2015-01-19 22:00:10 +01:00
public int LatestReplyAuthor { get; set; }
2015-01-26 13:13:06 +01:00
[Column("latestComment")]
2015-01-19 22:00:10 +01:00
public int LatestComment { get; set; }
2015-01-26 13:13:06 +01:00
[Column("replies")]
2015-01-19 22:00:10 +01:00
public int Replies { get; set; }
2015-01-26 13:13:06 +01:00
[Column("score")]
2015-01-19 22:00:10 +01:00
public int Score { get; set; }
2015-01-26 13:13:06 +01:00
[Column("locked")]
2015-01-19 22:00:10 +01:00
public bool Locked { get; set; }
2015-01-26 13:13:06 +01:00
[Column("version")]
public int Version { get; set; }
public string GetUrl()
2015-01-26 13:13:06 +01:00
{
var url = library.NiceUrl(this.ParentId);
return GlobalSettings.UseDirectoryUrls
? string.Format("/{0}/{1}-{2}", url.Trim('/'), Id, UrlName)
: string.Format("/{0}/{1}-{2}.aspx", url.Substring(0, url.LastIndexOf('.')).Trim('/'), Id, UrlName);
2015-01-26 13:13:06 +01:00
}
2015-01-19 22:00:10 +01:00
}
}