41 lines
1.0 KiB
C#
41 lines
1.0 KiB
C#
namespace YLErp.Web.Controllers
|
|
{
|
|
public class AppConfigController : BaseController
|
|
{
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
public JsonResult AjaxSave(string name, string value)
|
|
{
|
|
if (string.IsNullOrEmpty(name))
|
|
{
|
|
return JsonError("保存失败,请求参数不能为空");
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(value))
|
|
{
|
|
value = Uri.UnescapeDataString(value);
|
|
}
|
|
|
|
AppConfig data = null;
|
|
|
|
using (var db = DbContextFactory.GetYLDbContext())
|
|
{
|
|
data = db.AppConfig.FirstOrDefault(n => n.PGroup == "ProjectConfig" && n.PName == name);
|
|
|
|
if (data == null)
|
|
{
|
|
return JsonError("保存失败,没有找到配置数据");
|
|
}
|
|
|
|
data.PValue = value;
|
|
PS.SetConfig(name, value);
|
|
db.SaveChanges();
|
|
}
|
|
|
|
|
|
return JsonSuccess();
|
|
}
|
|
}
|
|
}
|