public async Task SendContactSupplierAboutProductEmail(ContactSupplierBody template) { var supplier = await _oc.Suppliers.GetAsync <HSSupplier>(template.Product.DefaultSupplierID); var supplierEmail = supplier.xp.SupportContact.Email; var templateData = new EmailTemplate <ProductInformationRequestData>() { Data = new ProductInformationRequestData { ProductID = template?.Product?.ID, ProductName = template?.Product?.Name, FirstName = template?.BuyerRequest?.FirstName, LastName = template?.BuyerRequest?.LastName, Location = template?.BuyerRequest?.BuyerLocation, Phone = template?.BuyerRequest?.Phone, Email = template?.BuyerRequest?.Email, Note = template?.BuyerRequest?.Comments } }; await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, supplierEmail, _settings?.SendgridSettings?.ProductInformationRequestTemplateID, templateData); var sellerUsers = await ListAllAsync.List((page) => _oc.AdminUsers.ListAsync <HSUser>( filters: $"xp.RequestInfoEmails=true", page: page, pageSize: 100 )); foreach (var sellerUser in sellerUsers) { await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, sellerUser.Email, _settings?.SendgridSettings?.ProductInformationRequestTemplateID, templateData); if (sellerUser.xp.AddtlRcpts.Any()) { foreach (var rcpt in sellerUser.xp.AddtlRcpts) { await SendSingleTemplateEmail(_settings?.SendgridSettings?.FromEmail, rcpt, _settings?.SendgridSettings?.ProductInformationRequestTemplateID, templateData); } } } }
public async Task RequestProductInfo([FromBody] ContactSupplierBody template) { await _meProductCommand.RequestProductInfo(template); }
public async Task RequestProductInfo(ContactSupplierBody template) { await _sendgridService.SendContactSupplierAboutProductEmail(template); }