예제 #1
0
        public ActionResult NewsType_Edit(t_news_type model)
        {
            string sql   = string.Format("update t_news_type t set t.name='{0}' where t.id={1}", model.name, model.id);
            int    count = DbHelperMySQL.ExecuteSql(sql);

            return(Json(Result.AutoResult(count), JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public ActionResult NewsType_Add(t_news_type model)
        {
            string sql   = string.Format("select count(*) from t_news_type t where t.del=0 and t.name='{0}'", model.name);
            int    count = Convert.ToInt32(DbHelperMySQL.GetSingle(sql));

            if (count != 0)
            {
                return(Json(Result.Error("该新闻分类已存在", -1), JsonRequestBehavior.AllowGet));
            }
            sql   = string.Format("insert into t_news_type(name,del) values('{0}',0)", model.name);
            count = DbHelperMySQL.ExecuteSql(sql);
            return(Json(Result.AutoResult(count), JsonRequestBehavior.AllowGet));
        }