using cy_scdz.ViewModel.dictionary.DictionaryVMs;
|
using cy_scdz.ViewModel.Setting;
|
using Microsoft.AspNetCore.Mvc;
|
using System.ComponentModel.DataAnnotations;
|
using WalkingTec.Mvvm.Core;
|
using WalkingTec.Mvvm.Mvc;
|
|
namespace cy_scdz.Areas.Setting.Controllers
|
{
|
[Area("Setting")]
|
[ActionDescription("系统设置")]
|
public class SettingController : BaseController
|
{
|
#region Edit
|
[ActionDescription("系统设置")]
|
public ActionResult Index()
|
{
|
var vm = Wtm.CreateVM<SettingVm>();
|
return PartialView(vm);
|
}
|
|
|
|
|
|
|
[ActionDescription("系统设置")]
|
[HttpPost]
|
public ActionResult Edit ([FromBody]EditSettingParam Param)
|
{
|
if (string.IsNullOrEmpty(Param.key))
|
return Ok(new { code = 0});
|
var vm= Wtm.CreateVM<SettingVm>(passInit:true);
|
|
vm.addNew(Param.name, Param.key);
|
if(vm.MSD.IsValid)
|
{
|
return Ok(new { code = 1 });
|
}
|
else
|
|
return Ok(new { code = 0,msg=vm.MSD.GetFirstError()});
|
}
|
|
|
#endregion
|
}
|
/// <summary>
|
/// 增加设置输入参数模型
|
/// </summary>
|
public class EditSettingParam
|
{
|
/// <summary>
|
/// keyname
|
/// </summary>
|
[Required]
|
public string key { get; set; }
|
/// <summary>
|
/// 名称
|
/// </summary>
|
[Required]
|
public string name { get; set; }
|
|
}
|
}
|