예제 #1
0
        public async Task PublishAllTestTemplates()
        {
            foreach (var item in TEST_TEMPLATES)
            {
                var mailTemplate = await _mailTemplateHelper.FetchAsync(item, false);

                if (mailTemplate?.ID > 0)
                {
                    await _mailTemplateRepository.SaveAsync(mailTemplate, mailTemplate.UserID.Value, TEST_USER_NAME, TEST_USER_EMAIL);

                    await _mailTemplateRepository.PublishAsync(mailTemplate, mailTemplate.UserID.Value, TEST_USER_NAME, TEST_USER_EMAIL);
                }
                else
                {
                    Assert.Fail($"Mailtemplate '{item}' wasn't found");
                }
            }
        }
예제 #2
0
        private async Task MailTemplatesList_ListSave(ComponentListEventArgs e)
        {
            var currentTemplateInDatabase = await _mailTemplateListRepository.FetchSingleAsync(Implement.ID);

            var result = await _mailTemplateListRepository.FetchSingleByIdentifierAsync(Identifier);

            if (result != null && result.ID != Implement.ID)
            {
                await Notification.InsertOneAsync("Wim.Module.MailTemplate", $"Identifier {Identifier} is already in use.");
            }

            var id = await _mailTemplateRepository.SaveAsync(Implement, wim.CurrentApplicationUser.ID, wim.CurrentApplicationUser.Displayname, wim.CurrentApplicationUser.Email);

            Response.Redirect(wim.GetUrl(new KeyValue[] {
                new KeyValue {
                    Key = "list", Value = wim.CurrentList.ID
                },
                new KeyValue {
                    Key = "item", Value = id
                }
            }));
        }