public EmailTemplateInfo GetById(int id)
        {
            var template = _dataBase.GetEmailTemplateById(id);
            var emailTemplateInfo = new EmailTemplateInfo();

            emailTemplateInfo.Id = template.Id;
            emailTemplateInfo.Body = template.Body;
            emailTemplateInfo.Subject = template.Subject;
            if (template.branch != null)
            {
                emailTemplateInfo.BranchInfo = new BranchInfo
                {
                    Id = template.branch.branch_num,
                    Name = template.branch.name
                };
            }
            if (template.campain != null)
            {
                emailTemplateInfo.CampaignInfo = new CampaignInfo
                {
                    Id = template.campain.mis_campain,
                    Name = template.campain.teur_campain
                };
            }
            return emailTemplateInfo;
        }
 private static EmailTemplateViewModel ToEmailTemplateViewModel(EmailTemplateInfo templateInfo)
 {
     return new EmailTemplateViewModel
     {
         Id = templateInfo.Id,
         Body = templateInfo.Body,
         Subject = templateInfo.Subject,
         BranchName = templateInfo.BranchInfo != null ? templateInfo.BranchInfo.Name : "",
         CampaignName = templateInfo.CampaignInfo != null ? templateInfo.CampaignInfo.Name : ""
     };
 }
 public bool Edit(EmailTemplateInfo emailTemplateInfo)
 {
     return _dataBase.EditEmailTemplate(new EmailsTemplate { Id = emailTemplateInfo.Id, Body = emailTemplateInfo.Body, Subject = emailTemplateInfo.Subject });
 }