Exemplo n.º 1
0
        private void DoAdActions(string action)
        {
            AdService ads = AdService.GetInstance();

            if (action.Equals("AdEnable"))
            {
                string id = Request["Id"];
                int    r  = ads.Enable(id);
                if (r > 0)
                {
                    json = "{\"result\":1}";
                }
                else
                {
                    json = "{\"result\":0, \"msg\":\"服务器发生错误,状态改变失败!\"}";
                }
            }
            else if (action.Equals("AdDelete"))
            {
                string id = Request["Id"];
                try
                {
                    ads.DeleteModel(id);

                    json = "{\"result\":1}";
                }
                catch (Exception ex)
                {
                    json = "{\"result\":0, \"msg\":\"" + ex.Message + "\"}";
                }
            }
        }