Put interface behind database provider for testing. Use state object to get data from database, then map to model.

This commit is contained in:
Robert Marshall 2019-04-14 21:49:01 +01:00
parent 5a0d0933ce
commit 20ccdd07f1
11 changed files with 118 additions and 34 deletions

View file

@ -1,9 +1,27 @@
using System;
using Website.Data.States;
namespace Website.Models
{
public class BlogPost
{
public int PostId { get; set; }
public string PostTitle { get; set; }
public string Post_Title { get; set; }
public BlogPost(BlogPostState state)
{
Id = state.Post_Id;
Title = state.Post_Title;
Content = state.Post_Content;
Timestamp = state.Post_Timestamp;
Draft = state.Post_Draft;
Url = state.Post_Url;
UserId = state.User_Id;
}
public int Id { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public DateTime Timestamp { get; set; }
public string Draft { get; set; }
public string Url { get; set; }
public int UserId { get; set; }
}
}