Beispiel #1
0
        static void Main(string[] args)
        {
            var htmlTemplate = new HtmlTemplate("New article");
            var result       = htmlTemplate.GetTemplate("This is the page with new C# article");

            Console.WriteLine(result);
            Console.WriteLine("---");
            Console.WriteLine(htmlTemplate.DecodeString(result));

            //var secretTemplate = new SecretDocumentTemplate();
            //var result = secretTemplate.GetTemplate("This is a template of secret document");
            //Console.WriteLine(result);
            //Console.WriteLine("---");
            //Console.WriteLine(secretTemplate.DecodeString(result));
        }
        public async Task Consume(ConsumeContext <AccountCreateNotification> context)
        {
            var eventData = context.Message;

            _emailService.SendEmail(new EmailMessage {
                ToAddresses = { new EmailAddress(eventData.Email) },
                Subject     = eventData.Title,
                Content     = HtmlTemplate.GetTemplate(eventData.Title, eventData.Message)
            });

            _unitOfWork.NotificationLogRepository.Create(
                new NotificationLog {
                Type = "Account Create Notification",
                Name = "Account Create Notification"
            });

            _unitOfWork.Commit();
        }
        public async Task Consume(ConsumeContext <GeneratePasswordResetTokenNotification> context)
        {
            var eventData = context.Message;

            _emailService.SendEmail(new EmailMessage
            {
                ToAddresses = { new EmailAddress(eventData.Email) },
                Subject     = eventData.Title,
                Content     = HtmlTemplate.GetTemplate(eventData.Title, eventData.Message + $" <b>{eventData.Token}</b>")
            });

            _unitOfWork.NotificationLogRepository.Create(
                new NotificationLog
            {
                Type = "Generate Password ResetCode Notification",
                Name = "Password recovery"
            });

            _unitOfWork.Commit();
        }