Edit and create blog posts
This commit is contained in:
parent
47431d4650
commit
44875a6a45
6 changed files with 126 additions and 1 deletions
|
@ -5,6 +5,10 @@ namespace Website.Models
|
|||
{
|
||||
public class BlogPost
|
||||
{
|
||||
public BlogPost() {
|
||||
|
||||
}
|
||||
|
||||
public BlogPost(BlogPostState state)
|
||||
{
|
||||
Id = state.Post_Id;
|
||||
|
@ -23,5 +27,17 @@ namespace Website.Models
|
|||
public string Draft { get; private set; }
|
||||
public string Url { get; private set; }
|
||||
public int UserId { get; private set; }
|
||||
|
||||
private void GenerateUrl() {
|
||||
Url = Title.Replace(' ', '-');
|
||||
}
|
||||
|
||||
public void UpdateTitle(string title) {
|
||||
Title = title;
|
||||
GenerateUrl();
|
||||
}
|
||||
|
||||
public void UpdateDraft(string content) => Draft = content;
|
||||
public void Publish() => Content = Draft;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue