示例#1
0
        public async Task <ActionResult> Config()
        {
            using (ConfigDataProvider dataProvider = new ConfigDataProvider()) {
                Model model     = new Model {
                };
                ConfigData data = await dataProvider.GetItemAsync();

                if (data == null)
                {
                    throw new Error(this.__ResStr("notFound", "The messenger settings could not be found"));
                }
                model.SetData(data);
                return(View(model));
            }
        }
示例#2
0
        public async Task <ActionResult> Config()
        {
            using (ConfigDataProvider configDP = new ConfigDataProvider()) {
                Model model     = new Model {
                };
                ConfigData data = await configDP.GetItemAsync();

                if (data == null)
                {
                    throw new Error(this.__ResStr("notFound", "Currency converter configuration not found."));
                }
                model.SetData(data);
                return(View(model));
            }
        }
示例#3
0
        public async Task <ActionResult> Config_Partial(Model model)
        {
            using (ConfigDataProvider dataProvider = new ConfigDataProvider()) {
                ConfigData data = await dataProvider.GetItemAsync();// get the original item

                if (!ModelState.IsValid)
                {
                    return(PartialView(model));
                }
                data = model.GetData(data); // merge new data into original
                model.SetData(data);        // and all the data back into model for final display
                await dataProvider.UpdateConfigAsync(data);

                return(FormProcessed(model, this.__ResStr("okSaved", "Messenger Settings saved")));
            }
        }
示例#4
0
        public async Task <ActionResult> Config_Partial(Model model)
        {
            using (ConfigDataProvider configDP = new ConfigDataProvider()) {
                ConfigData data = await configDP.GetItemAsync();// get the original item

                if (data == null)
                {
                    throw new Error(this.__ResStr("alreadyDeleted", "The currency converter configuration has been removed and can no longer be updated."));
                }

                if (!ModelState.IsValid)
                {
                    return(PartialView(model));
                }

                data = model.GetData(data);             // merge new data into original
                model.SetData(data);                    // and all the data back into model for final display

                await configDP.UpdateConfigAsync(data); // save updated item

                return(FormProcessed(model, this.__ResStr("okSaved", "Currency converter configuration saved")));
            }
        }