Add SQLite code to save the policy html/markdown scripts from the user #94
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using Interfaces;
|
|
|
|
namespace SQLiteRepository.Converters
|
|
{
|
|
static class PolicyConverter
|
|
{
|
|
public static Policy ConvertToPolicyDto(PolicyDb policyDb)
|
|
{
|
|
if (policyDb == null) return null;
|
|
return new Policy
|
|
{
|
|
ChangeDescription = policyDb.ChangeDescription,
|
|
ChangeDate = policyDb.ChangeDate.UtcDateTime,
|
|
Html = policyDb.Html,
|
|
Version = policyDb.Version,
|
|
ChangeAuthor = policyDb.ChangeAuthor,
|
|
Markdown = policyDb.Markdown
|
|
};
|
|
}
|
|
|
|
public static PolicyDb ConvertFromPolicyDto(Policy policy)
|
|
{
|
|
if (policy == null) return null;
|
|
return new PolicyDb
|
|
{
|
|
ChangeDescription = policy.ChangeDescription,
|
|
ChangeDate = policy.ChangeDate,
|
|
Html = policy.Html,
|
|
Version = policy.Version,
|
|
ChangeAuthor = policy.ChangeAuthor,
|
|
Markdown = policy.Markdown
|
|
};
|
|
}
|
|
}
|
|
} |