示例#1
0
        //
        // GET: /WeiXin/Goods/

        public ActionResult List(Guid SubscribeID)
        {
            ViewBag.SubscribeID = SubscribeID;

            Subscriber_BLL subbll = new Subscriber_BLL();

            Subscriber mysub = subbll.Get(a => a.SubscribeID == SubscribeID);

            ViewBag.MyScore = mysub.Score;
            Goods_BLL    bll        = new Goods_BLL();
            List <Goods> sourselist = bll.GetList(a => a.AccountID == mysub.AccountID && a.IsSelling == true && a.Count > 0).OrderByDescending(a => a.CreateTime).ToList();


            AutoMapper.Mapper.CreateMap <Goods, Goods_ViewModel>();
            List <Goods_ViewModel> list = AutoMapper.Mapper.Map <List <Goods_ViewModel> >(sourselist);


            return(View(list));
        }
        public ActionResult MyList()
        {
            if (Session["CurrentAccountID"] == null)
            {
                return(RedirectToAction("Select", "OfficialAccount", new { Area = "Admin" }));
            }
            Guid accountid = Guid.Parse(Session["CurrentAccountID"].ToString());



            Goods_BLL    bll        = new Goods_BLL();
            List <Goods> sourselist = bll.GetList(a => a.AccountID == accountid).OrderByDescending(a => a.CreateTime).ToList();

            AutoMapper.Mapper.CreateMap <Goods, Goods_ViewModel>()
            .ForMember(dest => dest.UserName, opt => opt.MapFrom(src => src.Users.UserName));
            List <Goods_ViewModel> list = AutoMapper.Mapper.Map <List <Goods_ViewModel> >(sourselist);


            return(View(list));
        }