コード例 #1
0
        //删除网站更新地址
        public ActionResult delHrefCity()
        {
            var id    = Convert.ToInt64(Request["IDs"]);
            var tdata = T_UpHerfCityService.LoadEntities(x => x.ID == id).FirstOrDefault();

            if (tdata != null)
            {
                if (T_UpHerfCityService.DeleteEntity(tdata))
                {
                    return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { msg = "没有成功删除信息!" }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { msg = "数据库中没有找到要删除的项目!" }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
 //添加网站更新地址
 public ActionResult AddHrefCity(T_UpHerfCity tpe)
 {
     if (tpe.ID <= 0)
     {
         if (T_UpHerfCityService.LoadEntities(x => x.Items == tpe.Items && x.City_ID == tpe.City_ID).FirstOrDefault() == null)
         {
             tpe.Del     = 0;
             tpe.AddTime = MvcApplication.GetT_time();
             tpe.AddUser = LoginUser.ID;
             T_UpHerfCityService.AddEntity(tpe);
             return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { msg = "不可添加重复的更新地址!~", JsonRequestBehavior.AllowGet }));
         }
     }
     else
     {
         return(Json(new { msg = "添加出错,请联系管理员!~", JsonRequestBehavior.AllowGet }));
     }
 }
コード例 #3
0
        // 获取网站更新地址
        public ActionResult GetHrefCity()
        {
            int pageIdex = Request["page"] != null?int.Parse(Request["page"]) : 1;

            int pageSize = Request["rows"] != null?int.Parse(Request["rows"]) : 35;

            int totalcount = int.MaxValue;
            var mydata     = T_UpHerfCityService.LoadPageEntities(pageIdex, pageSize, out totalcount, x => x.Del == 0, x => x.AddTime, true);
            var temp       = from a in mydata
                             select new
            {
                ID       = a.ID,
                City     = a.T_City.City,
                Province = a.T_City.T_province.str,
                Items    = a.Items,
                Href     = a.Href,
                textbak  = a.textbak,
                AddTime  = a.AddTime,
            };

            return(Json(new { rows = temp, total = totalcount }, JsonRequestBehavior.AllowGet));
        }