示例#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 Add(Map model)
        {
            var rst = new ReturnResult <bool>();

            using var bll = new MapBll();
            if (model.id == 0)
            {
                rst = bll.Add(model);
                if (rst.Result)
                {
                    HandleEvent.ChangeMap((int)ChangeMapType.新增, model);
                }
            }
            else
            {
                rst = bll.Update(model);
                if (rst.Result)
                {
                    HandleEvent.ChangeMap((int)ChangeMapType.修改, model);
                }
            }

            return(Json(rst));
        }