Example #1
0
        public ActionResult Publish()
        {
            string userId = Com.Cos.Common.Public.GetLoginUid().ToString();
            int    totalRecord;
            var    exchanges = _exchangeService.FindPageList(1, 5, out totalRecord, e => e.UserId == userId, "AddTime", false).ToList();

            ViewBag.PageIndex   = 1;
            ViewBag.PageSize    = 5;
            ViewBag.TotalRecord = totalRecord;
            for (int i = 0; i < exchanges.Count; i++)
            {
                exchanges[i].Examine = _exchangeExamineService.Find(exchanges[i].Examine.ToInt32()).ExamineName;
                string coverId = exchanges[i].Cover;
                if (string.IsNullOrEmpty(coverId))  //如果没有封面,则取第一张图片
                {
                    string   imgList = exchanges[i].ImgList;
                    string[] imgs    = imgList.Split(',');
                    coverId = imgs[0];
                }
                string cover = TWEBURL.WEB_URL_IMG + _imgService.Find(coverId.ToInt32())?.ImgSmallUrl;
                exchanges[i].Cover = cover;
            }
            ViewBag.Exchanges = exchanges;
            return(View("Publish"));
        }
Example #2
0
        public ActionResult Detail(int id)
        {
            var exchange = _exchangeService.Find(id);

            exchange.Certificate = TWEBURL.WEB_URL_IMG + _imgService.Find(exchange.Certificate.ToInt32())?.ImgBigUrl;
            string[] imgs = exchange.ImgList.Split(',');
            exchange.ImgList = "";
            foreach (string img in imgs)
            {
                exchange.ImgList += TWEBURL.WEB_URL_IMG + _imgService.Find(img.ToInt32())?.ImgBigUrl + ",";
            }
            exchange.ImgList = exchange.ImgList.TrimEnd(',');
            exchange.Examine = exchange.Examine == null ? "0" : exchange.Examine == "0" ? "0" : exchange.Examine;
            exchange.ClassId = _exchangeClassService.Find(exchange.ClassId.ToInt32()).ClassName;

            ViewBag.Exchange = exchange;
            var member = _memberService.Find(exchange.UserId.ToInt32());  //发布该兑换信息的用户

            member.Portrait = TWEBURL.WEB_URL_IMG + member.Portrait;
            ViewBag.Member  = member;
            return(View("Detail"));
        }