public virtual ViewResult Index(long id)
        {
            var state = _states.Get(_identity.Language, id).First().Value;

            ViewBag.StateName = state.LocalizedName;

            var availabilities = _settings.GetStateAvailabilities().Where(x => x.StateId == id).Select(x => x.Role).ToArray();
            var visibilities   = _settings.GetStateVisibilities().Where(x => x.StateId == id).Select(x => x.Role).ToArray();

            var model = new StateSettingsModel
            {
                Availabilities = EmailTemplateSettingsModelHelper.GetModel(availabilities),
                Visibilities   = EmailTemplateSettingsModelHelper.GetModel(visibilities)
            };

            return(View(model));
        }
Beispiel #2
0
        private EventTemplateModel GetModel(EventType eventType, string language)
        {
            var commonData = _templates.GetByEventType(eventType);

            var localization = commonData != null?_templates.GetLocalization(commonData.EmailTemplateId, language) : null;

            var recipients = _recipients.GetRecipientRoles(eventType);

            return(new EventTemplateModel
            {
                Body = localization != null ? localization.Body : null,
                Subject = localization != null ? localization.Subject : null,
                EnableEmailSend = commonData != null && commonData.EnableEmailSend,
                Language = language,
                EventType = eventType,
                Settings = EmailTemplateSettingsModelHelper.GetModel(recipients)
            });
        }