Esempio n. 1
0
        private async Task SendUserContact(ContactNotification model)
        {
            var htmlContent = await base._viewRenderer.RenderViewToString("Views/Admin/ContactFromUser.cshtml", new ContactFromUserViewModel()
            {
                CompanyName   = model.CompanyName,
                CostumerEmail = model.CostumerEmail,
                CostumerName  = model.CostumerName,
                Message       = model.Message,
                Subject       = model.Subject
            });

            var plainTextContent = base._plainTextContentRenderer.RenderModelToString(new
            {
                Nome     = model.CostumerName,
                Email    = model.CostumerEmail,
                Assunto  = model.Subject,
                Memsagem = model.Message,
            });

            var emailDetail = new EmailDetail()
            {
                ToEmail          = model.CompanyEmail,
                ToName           = model.CompanyName,
                Subject          = $"[Contact From {model.CompanyName} Site: {model.Subject}]",
                PlainTextContent = plainTextContent,
                HtmlContent      = htmlContent,
                FromEmail        = model.CostumerEmail,
                FromName         = model.CostumerName,
            };

            await base._emailService.SendEmail(emailDetail);
        }
 public void DeleteContactNotification(ContactNotification contactNotification)
 {
     _socialNetworkContext.Set <ContactNotification>().Remove(contactNotification);
 }
Esempio n. 3
0
        public async Task <IActionResult> PostAsync(ContactNotification request)
        {
            await this.SendUserContact(request);

            return(Ok());
        }
 public async Task AddContactNotification(ContactNotification contactNotification)
 {
     await _socialNetworkContext.Set <ContactNotification>().AddAsync(contactNotification);
 }