Пример #1
0
        public void List2()
        {
            /// 返回的数据格式
            /// {
            ///     "Building_id", int,
            ///     "Nickname": string
            /// }
            var db  = new DbHelper.Buildings().Db;
            var res = db.Queryable <sdglsys.Entity.T_Building, Entity.T_Dorm>((b, d) => new object[] { JoinType.Left, b.Building_dorm_id == d.Dorm_id }).Where(b => b.Building_model_state && b.Building_is_active && b.Building_is_active && b.Building_model_state).Select((b, d) => new
            {
                b.Building_id,
                d.Dorm_nickname,
                b.Building_nickname
            }).ToJson();

            Response.Write(res);
        }
Пример #2
0
        public ActionResult Create()
        {
            var vbuildings = new List <Entity.VBuilding>();

            try
            {
                var Buildings = new DbHelper.Buildings();
                vbuildings = ((int)Session["role"] < 3) ? Buildings.GetAllActiveById((int)Session["pid"]) : Buildings.GetAllActive();
                // 非系统管理员只能看到所属于园区的宿舍
            }
            catch (Exception)
            {
                throw;
            }

            return(View(vbuildings));
        }