示例#1
0
        public ActionResult List()
        {
            // 先获取当前 用户
            Member     member  = _memberBLL.GetMemberByOpenId(System.Web.HttpContext.Current.Session["member"].ToString());
            List <Car> carList = _carBLL.GetCarListByMemberId(member.Id).ToList();

            ViewData["CarList"] = carList;
            return(View());
        }
示例#2
0
        /// <summary>
        /// 列出用户的爱车啊
        /// </summary>
        /// <returns></returns>
        public ActionResult List()
        {
            // 上来先获取最新用户的前10名
            List <Member> memberList = _memberBLL.GetMemberswithSpecifiedCount(10).ToList();

            List <CarModel> carList = new List <CarModel>();

            // 遍历用户列表 构造CarModel列表
            foreach (var item in memberList)
            {
                foreach (var car in _carBLL.GetCarListByMemberId(item.Id))
                {
                    CarModel cm = new CarModel(car);
                    cm.MemberName      = item.NickeName;
                    cm.Phone           = item.Phone;
                    cm.MemberImagePath = item.HeadImage;

                    carList.Add(cm);
                }
            }
            // 返回CarModel列表
            ViewData["CarList"] = carList;
            return(View());
        }