liaoxujun@qq.com
2024-02-19 c32275f697e1541694836c47e1682e3291673dbc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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; }
 
    }
}