Esempio n. 1
0
        public IActionResult Add(Map model)
        {
            var rst = new ApiResult <bool>();

            var bll = new MapBll();

            if (model.id == 0)
            {
                rst = bll.Add(model);
                if (rst.Result)
                {
                    ServerManager.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)
                    {
                        //改了所属主机  删掉原来的  新增修改后的
                        ServerManager.ChangeMap((int)ChangeMapType.除, map.Data);
                        ServerManager.ChangeMap((int)ChangeMapType.新增, model);
                    }
                    else
                    {
                        ServerManager.ChangeMap((int)ChangeMapType.修改, model);
                    }
                }
            }

            return(Json(rst));
        }
Esempio n. 2
0
        public IActionResult Delete(Map model)
        {
            var bll = new MapBll();
            var rst = bll.Delete(model);

            if (rst.Result)
            {
                ServerManager.ChangeMap((int)ChangeMapType.除, model);
            }

            return(Json(rst));
        }