Beispiel #1
0
        public async Task SendCompanyLeadHooked(Guid leadId, IUrlHelper url, HttpRequest httpRequest)
        {
            var company = _uow.CompanyRepository.GetFirst();

            if (url == null)
            {
                if (this.Url == null)
                {
                    throw new ApplicationException("IUrlHelper in the context is null.");
                }
            }

            if (httpRequest == null)
            {
                if (this.Request == null)
                {
                    throw new ApplicationException("HttpRequest in the context is null.");
                }
            }

            var callbackLink = (url ?? this.Url).LeadHookedCallbackLink(leadId, (httpRequest != null) ? httpRequest.Scheme : this.Request.Scheme);

            var    lead         = _leadRepo.GetByUid(leadId);
            string leadTypeName = _leadTypeRepo.Get(lead.LeadTypeId)?.Name.ToLower();
            string subject      = $"New {leadTypeName} lead link";

            await _emailSender.SendCompanyLeadHookedAsync(subject, company.Email, callbackLink);
        }