Пример #1
0
        public IActionResult Add(Map model)
        {
            var rst = new ReturnResult <bool>();

            var bll = new MapBll();

            if (model.id == 0)
            {
                rst = bll.Add(model);
                if (rst.Result)
                {
                    ServerHanlder.ChangeMap((int)ChangeMapType.新增, model);
                }
            }
            else
            {
                var map = bll.GetOne(model);
                rst = bll.Update(model);
                if (rst.Result)
                {
                    if (model.client_id != map.Data.client_id)
                    {
                        //改了所属主机  删掉原来的  新增修改后的
                        ServerHanlder.ChangeMap((int)ChangeMapType.除, map.Data);
                        ServerHanlder.ChangeMap((int)ChangeMapType.新增, model);
                    }
                    else
                    {
                        ServerHanlder.ChangeMap((int)ChangeMapType.修改, model);
                    }
                }
            }

            return(Json(rst));
        }
Пример #2
0
        public IActionResult GetOne(Map model)
        {
            if (model.id == 0)
            {
                var defalut = new ReturnResult <Map>()
                {
                    Result = true,
                    Data   = new Map()
                };
                return(Json(defalut));
            }
            using var bll = new MapBll();
            var rst = bll.GetOne(model);

            return(Json(rst));
        }
Пример #3
0
        public IActionResult GetOne(Map model)
        {
            if (model.id == 0)
            {
                var defalut = new ReturnResult <Map>()
                {
                    Result = true,
                    Data   = new Map()
                    {
                        remote = GlobalConfig.DefaultUrl, proxy_type = (int)proxy_type.反向代理
                    }
                };
                return(Json(defalut));
            }
            var bll = new MapBll();
            var rst = bll.GetOne(model);

            return(Json(rst));
        }