Imports DigitalData.Modules.Base Imports EnvelopeGenerator.Domain.Constants Imports EnvelopeGenerator.Domain.Entities Public Class EmailTemplateModel Inherits BaseModel Public Sub New(pState As State) MyBase.New(pState) End Sub Private Function ToEmailTemplate(pRow As DataRow) As EmailTemplate Return New EmailTemplate() With { .Id = pRow.ItemEx("GUID", 0), .Name = pRow.ItemEx("NAME", ""), .Body = pRow.ItemEx("BODY", ""), .Subject = pRow.ItemEx("SUBJECT", "") } End Function Public Function GetById(pEmailTemplateName As EmailTemplateType) As EmailTemplate Dim oSql As String = $"SELECT * FROM TBSIG_EMAIL_TEMPLATE WHERE NAME = '{pEmailTemplateName}'" Dim oTable As DataTable = Database.GetDatatable(oSql) If oTable.Rows.Count = 0 Then Return Nothing End If Dim oRow = oTable.Rows.Item(0) Return ToEmailTemplate(oRow) End Function End Class