FlexitimeTracker/DataCenter_Windows/WindowsDataCenter/SQLiteRepository/Converters/PolicyConverter.cs
chris.watts90@outlook.com dc2210b5b3 Add Api Endpoint to save/retrieve the active policy.Policy
Add SQLite code to save the policy html/markdown scripts from the user
#94
2019-10-18 09:30:57 +01:00

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
};
}
}
}