public ActionResult Count() { //ViewBag.Count = ; int newTotalCount = 0; List<ViewChannelCount> vccList = new List<ViewChannelCount>(); ViewChannelCount vcc = new ViewChannelCount(); vcc.ChannelId = 5; vcc.ChannelName = "中石油-old"; vcc.SubscribeCount = DbServices.GetSubscribeCountByChannel(5, 1); vcc.UnSubscribeCount = DbServices.GetSubscribeCountByChannel(5, 0); vccList.Add(vcc); List<QRCode> qrcodelist = DbServices.GetQRCodeList(); foreach (var item in qrcodelist) { int channelid = 0; if (!String.IsNullOrEmpty(item.QRValue)) { channelid = Int32.Parse(item.QRValue); } if ((channelid >= 8) && (channelid <= 27)) { ViewChannelCount myvcc = new ViewChannelCount(); myvcc.ChannelId = channelid; myvcc.ChannelName = item.Title; myvcc.SubscribeCount = DbServices.GetSubscribeCountByChannel(channelid, 1); newTotalCount = newTotalCount + myvcc.SubscribeCount; myvcc.UnSubscribeCount = DbServices.GetSubscribeCountByChannel(channelid, 0); vccList.Add(myvcc); } } ViewBag.NewTotalCount = newTotalCount; ViewBag.ViewChannelCountList = vccList; return View(); }
public ActionResult ChannelCount(int? Id) { ViewChannelCount vcc = null; int channelId = 0; if (Id != null) { vcc = new ViewChannelCount(); var qrcode = DbServices.GetQRCodeById(Id.Value); if ((qrcode != null) && (!String.IsNullOrEmpty(qrcode.QRValue))) { vcc.ChannelName = qrcode.Title; var channel = Int32.Parse(qrcode.QRValue); vcc.SubscribeCount = DbServices.GetSubscribeCountByChannel(channel, 1); vcc.UnSubscribeCount = DbServices.GetSubscribeCountByChannel(channel, 0); vcc.TotalCount = vcc.SubscribeCount - vcc.UnSubscribeCount; vcc.ChannelId = channel; ViewBag.Vcc = vcc; channelId = vcc.ChannelId; } } ViewBag.Id = channelId; return View(); }