public List <EmailTemplateModel> GetEmailTemplateList(BaseViewModel model) { List <EmailTemplate> dataList; List <EmailTemplateModel> templateList = new List <EmailTemplateModel>(); EmailTemplateModel templateModel = new EmailTemplateModel(); try { dataList = _templateRepository.GetEmailTemplateList(); if (dataList != null) { foreach (EmailTemplate a in dataList) { templateModel = Mapper.Map <EmailTemplate, EmailTemplateModel>(a); templateModel.Name = Utility.GetPropertyValue(templateModel, "Name", model.CurrentCulture) == null ? string.Empty : Utility.GetPropertyValue(templateModel, "Name", model.CurrentCulture).ToString(); templateModel.Subject = Utility.GetPropertyValue(templateModel, "Subject", model.CurrentCulture) == null ? string.Empty : Utility.GetPropertyValue(templateModel, "Subject", model.CurrentCulture).ToString(); templateModel.Body = Utility.GetPropertyValue(templateModel, "Body", model.CurrentCulture) == null ? string.Empty : Utility.GetPropertyValue(templateModel, "Body", model.CurrentCulture).ToString(); templateModel.CurrentUserID = model.CurrentUserID; templateModel.CurrentCulture = model.CurrentCulture; templateList.Add(templateModel); } } } catch (Exception ex) { string message = LogException(ex, model.CurrentUserID); throw new Exception(message); } templateList.Sort(CompareDivisionByName); return(templateList); }
public List <IEmailTemplate> GetEmailTemplateList() { return(_repository.GetEmailTemplateList()); }