//删除省份
        public ActionResult delprovince()
        {
            var id    = Convert.ToInt64(Request["IDs"]);
            var tdata = T_provinceService.LoadEntities(x => x.ID == id).FirstOrDefault();

            if (tdata != null)
            {
                if (T_provinceService.DeleteEntity(tdata))
                {
                    return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { msg = "没有成功删除信息!" }, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(new { msg = "数据库中没有找到要删除的项目!" }, JsonRequestBehavior.AllowGet));
        }
        // 获取省份
        public ActionResult Getprovince()
        {
            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_provinceService.LoadPageEntities(pageIdex, pageSize, out totalcount, x => x.ID > 0, x => x.ID, true);
            var temp       = from a in mydata
                             select new
            {
                ID  = a.ID,
                ppp = a.ppp,
                str = a.str
            };

            return(Json(new { rows = temp, total = totalcount }, JsonRequestBehavior.AllowGet));
        }
 //添加省份
 public ActionResult Addprovince(T_province tpe)
 {
     if (tpe.ID <= 0)
     {
         // var ts = T_provinceService.LoadEntities(x => x.str == tpe.str).FirstOrDefault();
         if (T_provinceService.LoadEntities(x => x.str == tpe.str).FirstOrDefault() == null)
         {
             T_provinceService.AddEntity(tpe);
             return(Json(new { ret = "ok" }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { msg = "不可添加重复的省份!~", JsonRequestBehavior.AllowGet }));
         }
     }
     else
     {
         return(Json(new { msg = "添加出错,请联系管理员!~", JsonRequestBehavior.AllowGet }));
     }
 }
 public ActionResult Index()
 {
     ViewBag.province = T_provinceService.LoadEntities(x => x.ID > 0).DefaultIfEmpty().ToList();
     ViewBag.City     = T_CityService.LoadEntities(x => x.DelFlag == 0).DefaultIfEmpty().ToList();
     return(View());
 }