public async Task<IHttpActionResult> Put(AdminSiteConfigInfo info)
 {
     if (!ModelState.IsValid)
         return BadRequest(ModelState);
     info.UpdateTime = DateTime.Now;
     GlobalApplicationObject.Current.ApplicationContext.ConfigManager.SaveConfig<AdminSiteConfigInfo>(info);
     return Ok(info);
 }
        public async Task<IHttpActionResult> Post(AdminSiteConfigInfo info)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);
            info.UpdateTime = DateTime.Now;

            ApplicationContext.ConfigManager.SaveConfig<AdminSiteConfigInfo>(info);
            return Created<AdminSiteConfigInfo>("api/config/AdminSiteConfigInfo", info);
        }
예제 #3
0
 private static AdminSiteConfigInfo GetAdminConfig()
 {
     var adminConfig = ApplicationContext.ConfigManager.GetConfig<AdminSiteConfigInfo>();
     if (adminConfig == null)
     {
         //如果为NULL,则使用系统默认的设置
         adminConfig = new AdminSiteConfigInfo();
         ApplicationContext.ConfigManager.SaveConfig(adminConfig);
     }
     return adminConfig;
 }