zoukankan      html  css  js  c++  java
  • 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>
              }
  • 相关阅读:
    windows下cmd命令行上传代码到github的指定库
    Navicat Premium 12.1.11.0安装与激活
    windows部署Apollo
    C#事件-使用事件需要的步骤
    C#委托和事件
    C#事件委托概念
    C#中委托和事件的区别
    C#委托与事件
    C#细说多线程
    C# 堆栈(Stack)和队列(Queue)
  • 原文地址:https://www.cnblogs.com/romanticcrystal/p/12916455.html
Copyright © 2011-2022 走看看