Пример #1
0
        public JsonResult GetAddrById(int id)
        {
            T_AddrDAO dao  = new T_AddrDAO();
            T_Addr    addr = dao.GetById(id);

            return(Json(addr));
        }
Пример #2
0
        public JsonResult GetAddrListByUserId(int id)
        {
            T_AddrDAO     dao  = new T_AddrDAO();
            List <T_Addr> list = dao.GetByUserId(id);

            return(Json(list));
        }
Пример #3
0
        public JsonResult SaveOrUpdateAddr(int id, int userId, String name, String mobile, String addr, int defaultAddr)
        {
            T_AddrDAO dao      = new T_AddrDAO();
            T_Addr    addrInfo = new T_Addr();

            addrInfo.id          = id;
            addrInfo.userId      = userId;
            addrInfo.name        = name;
            addrInfo.mobile      = mobile;
            addrInfo.addr        = addr;
            addrInfo.defaultAddr = defaultAddr;

            if (addrInfo.defaultAddr == 1)
            {
                dao.SetDefaultAddrIsFalseByUserId(addrInfo.userId);
            }


            if (dao.GetById(addrInfo.id) == null)
            {
                dao.Add(addrInfo);
            }
            else
            {
                dao.Update(addrInfo);
            }

            return(Json("更新完毕"));
        }
Пример #4
0
        public JsonResult DelAddrById(int id)
        {
            T_AddrDAO dao = new T_AddrDAO();

            dao.DelById(id);
            return(Json("删除成功"));
        }
Пример #5
0
        public JsonResult List()
        {
            T_AddrDAO     dao  = new T_AddrDAO();
            List <T_Addr> list = dao.GetAll().Include(e => e.userEntity).ToList();

            ViewBag.list = list;

            return(Json(list));
        }