mvc返回多个结果集,返回多个视图

复制代码
System.Web.Mvc.ViewPage<dynamic>//这句不清楚到底有没有用,反正我没用到
public ActionResult Index()
    {
            IDictionary<string, object> entity = new Dictionary<string, object>();//声明一个字典健值对
            List<CiclSingerPic> lpc = new List<CiclSingerPic>();//实体一
            List<MSingerPage> lsp = new List<MSingerPage>();//实体二
            List<CiclNews> lcn = new List<CiclNews>();//实体三
            Dictionary<object, object> dne = new Dictionary<object, object>();//健值对。
            lpc = new ProductLogic().ReadHomeMessage(ref lsp, ref dne, ref lcn);//从Model中取值给上面声明的实体及健值对
            entity.Add("topb", lpc);//添回到IDictionary
            entity.Add("about", lsp);//添回到IDictionary
            entity.Add("dnes", dne);//添回到IDictionary
            entity.Add("lcn", lcn);//添回到IDictionary
            return View(entity);//返回视图
    }
 
          @foreach (var item in (IList<CiclEntity.CiclSingerPic>)Model["topb"])//实体1
          {
             <li><a href="@item.LinkHtml" target="_blank"><img src="@item.ImbBig" alt="@item.Expression" /></a></li>
          }   
          @{Html.RenderAction("SubString", "public", new { id = ((IList<CiclEntity.MSingerPage>)Model["about"])[2].CContent });} //实体二   
          @foreach (var item in (Dictionary<object, object>)Model["dnes"])//
          {
             <li><a href="/title.html/@item.Key">@item.Value</a></li>
          }
复制代码

 

posted @   大da脸  阅读(311)  评论(0编辑  收藏  举报
编辑推荐:
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
阅读排行:
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
· 上周热点回顾(2.17-2.23)
点击右上角即可分享
微信分享提示