public IActionResult MailSend(PostMailViewModel postMailViewModel) { _publisherService.Enqueue( PrepareMessages(postMailViewModel), RabbitMQConsts.RabbitMqConstsList.QueueNameEmail.ToString() ); return(View()); }
public IActionResult Post(int Post) { Post p = postRepo.RetrievePostById(Post); var mapper = mapextension.PostToPostMailViewModel(); PostMailViewModel model = mapper.Map <PostMailViewModel>(p); return(View("SinglePost", model)); }
private IEnumerable <MailMessageData> PrepareMessages(PostMailViewModel postMailViewModel) { var users = _userListData.GetData().ToList(); var messages = new List <MailMessageData>(); for (int i = 0; i < users.Count; i++) { messages.Add(new MailMessageData() { To = users[i].Email.ToString(), From = _smtpConfig.User, Subject = postMailViewModel.Post.Title, Body = postMailViewModel.Post.Content }); } return(messages); }
public IActionResult MailSend2(PostMailViewModel postMailViewModel) { return(View(postMailViewModel)); }