public async Task <Result <bool> > SendAffiliateEmail([FromBody] AffiliateEmailModel model) { if (!Validate(model)) { return(false); } var item = model.Convert(); return(await _affiliateService.SendAffiliateEmailAsync(item)); }
public Result <AffiliateEmailModel> GetAffiliateEmail(int id) { AffiliateEmailModel toReturn = new AffiliateEmailModel { FromName = "Vital Choice", FromEmail = "*****@*****.**", Subject = "Your Vital Choice affiliate account is ready." }; if (id == 2)//email { if (_appSettings.AffiliateEmailTemplate == null) { throw new NotSupportedException($"{SettingConstants.AFFILIATE_EMAIL_TEMPLATE} not configurated."); } string template = _appSettings.AffiliateEmailTemplate; template = template.Replace(SettingConstants.AFFILIATE_EMAIL_TEMPLATE_NAME_HOLDER, "{1}") .Replace(SettingConstants.AFFILIATE_EMAIL_TEMPLATE_ID_HOLDER, "{0}") .Replace(SettingConstants.TEMPLATE_PUBLIC_URL_HOLDER, $"https://{_appOptions.Value.PublicHost}/"); toReturn.Message = template; } if (id == 4)//emailDrSears { if (_appSettings.AffiliateEmailTemplate == null) { throw new NotSupportedException($"{SettingConstants.AFFILIATE_EMAIL_TEMPLATE_DR_SEARS} not configurated."); } string template = _appSettings.AffiliateEmailTemplateDrSears; template = template.Replace(SettingConstants.AFFILIATE_EMAIL_TEMPLATE_NAME_HOLDER, "{1}") .Replace(SettingConstants.AFFILIATE_EMAIL_TEMPLATE_ID_HOLDER, "{0}") .Replace(SettingConstants.AFFILIATE_EMAIL_TEMPLATE_EMAIL_HOLDER, "{2}") .Replace(SettingConstants.TEMPLATE_PUBLIC_URL_HOLDER, $"https://{_appOptions.Value.PublicHost}/"); toReturn.Message = template; } return(toReturn); }