tangxu
2024-01-12 0bc1bea9bf515e2111702eaca05e1ce83b8a15e2
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
namespace IStation.Application
{
    /// <summary>
    /// Open
    /// </summary>
    [Route("Open/ChenHang")]
    [ApiDescriptionSettings("ChenHang", Name = "陈行", Order = 10000)]
    public class ChenHang_Controller : IDynamicApiController
    {
        private readonly Service.ChengHang _service = new();
 
        /// <summary>
        /// 获取
        /// </summary>
        [Route("Get@V1.0")]
        [HttpGet]
        public string   Get()
        {
            return "okkkk";
            /*   var model = _service.GetDefault();
               return model == null ? null : new ChenHangDto(model);*/
        }
 
        /// <summary>
        /// 设置
        /// </summary>
        /// <param name="input"></param>
        [Route("Set@V1.0")]
        [HttpPost]
        public bool Set([Required] ChenHangInput input)
        {
            var ds = _service.GetDefault();
            if (ds == null)
            {
                var model = input.Adapt<ChenHangInput, Model.ChengHang>();
                var id = _service.Insert(model);
                return id > 0;
            }
            else
            {
                var rhs = new Model.ChengHang(ds);
                input.Adapt(rhs);
                var bol = _service.Update(rhs);
                return bol;
            }
        }
 
    }
}