public MailTemplates GetMailTemplates() { //string connectionString = ConfigurationManager.ConnectionStrings["DatabaseContext"].ConnectionString; List <MailTemplate> mailTemplatesList; using (var dc = new SqlConnection("")) { mailTemplatesList = dc.Query <MailTemplate>(@" SELECT [Id] ,[UserType] ,[Title] ,[EmailContent] ,[EmailDisclaimerNeeded] ,[TextContent] ,[Notes] ,[SendTo] ,[EmailDisclaimerContent] ,[SupportEmail] FROM [support].[MailTemplates]" ).ToList(); } var mailTemplates = new MailTemplates(); mailTemplatesList.ForEach(e => mailTemplates.Add(e)); return(mailTemplates); }