public override PluginConfigurationHandlerGetResponse Get(DiscoDataContext database, Controller controller)
        {
            var store = new ConfigurationStore(database);
            var model = store.DeserializeConfiguration();

            return(Response <Views.Configuration>(model));
        }
        public override bool Post(DiscoDataContext database, FormCollection form, Controller controller)
        {
            var store = new ConfigurationStore(database);
            var model = controller.ToConfigurationModel();

            if (model == null)
            {
                return(false);
            }
            model.UpdateStore(store);
            Internal.Email.SendEmailMessage(UserService.CurrentUser);
            return(true);
        }
예제 #3
0
        public static ConfigurationModel DeserializeConfiguration(this ConfigurationStore configStore)
        {
            var deserializedConfig = new JavaScriptSerializer().Deserialize <ConfigurationModel>(configStore.EmailConfiguration);

            return(new ConfigurationModel
            {
                CurrentVersion = deserializedConfig.CurrentVersion,
                SmtpServerAddress = deserializedConfig.SmtpServerAddress,
                SmtpServerPort = deserializedConfig.SmtpServerPort,
                EnableSsl = deserializedConfig.EnableSsl,
                SmtpSenderAddress = deserializedConfig.SmtpSenderAddress,
                AuthenticationRequried = deserializedConfig.AuthenticationRequried,
                SmtpUsername = deserializedConfig.SmtpUsername,
                SmtpPassword = deserializedConfig.SmtpPassword,
                MessageConfig = deserializedConfig.MessageConfig
            });
        }
예제 #4
0
 public static void UpdateStore(this ConfigurationModel model, ConfigurationStore configStore)
 {
     configStore.EmailConfiguration = new JavaScriptSerializer().Serialize(model);
 }