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")); }
public ActionResult Index(string examineUsName, string classUsName, string p) { int page = p.ToInt32(); //当前页 string examineId = _exchangeExamineService.Find(examineUsName)?.ExamineId; //兑换状态id string classId = _exchangeClassService.Find(classUsName)?.ClassId.ToString(); //兑换状态id page = page < 1 ? 1 : page; var exchanges = GetExchange(page, examineId, classId); ViewBag.Exchanges = exchanges; ViewBag.ExamineUsName = examineUsName; ViewBag.ClassUsName = classUsName; return(View("Index")); }