博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
查询数据(后台到前台传递数据,显示数据)
阅读量:5113 次
发布时间:2019-06-13

本文共 5880 字,大约阅读时间需要 19 分钟。

前台相关代码:

头部导入代码:

*@@model IDictionary
@{ var fuid = ViewContext.RouteData.Values["id"].GetString(); var list = (PagedList
)Model["list"]; var spaceTeam = (IQueryable
)Model["spaceteam"]; ViewBag.Title = "空间好友表"; ViewBag.ItemMenu = "Home"; Layout = "~/Areas/PersonalSpace/Views/Shared/master/_LayoutIndex.cshtml"; string ViewMode = Request["view"]; string Durl = ViewBag.Durl; if (string.IsNullOrEmpty(ViewMode)) { ViewMode = "list"; } string cId = ""; if (!string.IsNullOrWhiteSpace(Request["cid"])) { cId = Request["cid"]; } string order = Request["order"]; if (string.IsNullOrEmpty(order)) { order = "0"; } string strUserId = ViewBag.UserId; string loginUserId = LoginBLL.GetCurrentUserFid(); ViewData["UserId"] = strUserId;}

 

使用循环调用相关代码:

 

@using (Html.BeginForm())    {        
@*
*@
好友名称:
  
utList = bb.FindALL().Where(temp => temp.FId == fTypeId).ToList(); UserInfo utList = new UserInfo(); // string FUserImgSmall = && utList.Count > 0 --------------- /@friend.FFriendId if (utList != null) {
  • @if (friend.FFriendId != null) { string ImageUrl = String.IsNullOrEmpty(utList.FUserImgSmall) ? "/Images/uploadimg_default.jpg" : utList.FUserImgSmall;
    好友图片
    } else {
    好友图片 }
  • } } } }
    @* *@ @{ foreach (var friend in list) {@*
    *@ var fTypeId = friend.FFriendId; var userId = LoginBLL.GetCurrentUserFid(); using (SpaceFriendBLL bll = new SpaceFriendBLL()) { UserInfoBLL bb = new UserInfoBLL(); // List
    @friend.FFriendName @friend.FTeamId @if (friend.FType != null && (friend.FType.Trim() == "1" || friend.FType.Trim() == "2")) { } else {
    分组   
    } 解除好友关系
    @Html.Pager(list, new PagerOptions { NumericPagerItemCount = 3, ShowMorePagerItems = true, ShowFirstLast = false, PageIndexParameterName = "page", CurrentPagerItemWrapperFormatString = "
    {0}", NumericPagerItemWrapperFormatString = "
    {0}", AlwaysShowFirstLastPageNumber = true }, "PersonalSpace_default", null)
    }

     

     

     

     

     

     

     

    查询数据的后台代码:

    [HttpGet]        [SupportFilter(FCode = "PersonalSpace_SpaceFriend_List")]//判断页面是否有权限,FCode 调用枚举,没有的自己补,格式为:Areas_Controller_Action,例如:Heart_AgrBaseArea_Add        public ActionResult List(string cid, string keyword, string Durl,string pid, int page = 1, int pageSize = 20) //, string keyword        {            IsAuthorityButton("PersonalSpace_SpaceFriend_List");            IDictionary
    dic = new Dictionary
    (); using (UserInfoBLL ubll = new UserInfoBLL()) { // if (ui.FUserTypeId == "6daf56c8571e451ca017aaeb47e70a22")//ui.FRoleId f5450e699b414c9a8dfd3ebf9022d7a1 // SpaceFriend sf = new SpaceFriend(); // string FFriendId = sf.FFriendId; IQueryable
    ui = ubll.FindALL().Where(x => x.FRoleId == pid); // if (ui.FRoleId.Contains("f5450e699b414c9a8dfd3ebf9022d7a1")) if (ui.Equals("f5450e699b414c9a8dfd3ebf9022d7a1")) { // Durl = "/CompanySpace/SpaceFriend/List"; Durl = "personal/Home/Home/Index"; //personal/Home/Home/Index /CompanySpace/Home/Index } else { // Durl = "/Personal/Space/SpaceFriend/List"; //personal/Home/Home/Index /CompanySpace/Home/Index Durl = "/Personal/Home/Home/Index"; } ViewBag.Durl = Durl; } // var pageList = list.Skip((page - 1) * pageSize).Take(pageSize).ToList(); // var pageList2 = new PagedList
    (pageList, page, pageSize, pageList.Count()); var result = bll.GetSelSpaceFriends(CurrentUser.FId, cid, keyword).AsQueryable
    ().ToPagedList(page, 5);//, keyword // ViewBag.did = did; using (SpaceTeamBLL teambll = new SpaceTeamBLL()) { dic.Add("list", result); using (SpaceTeamBLL teambl = new SpaceTeamBLL()) { IQueryable
    team = teambll.FindALL().Where(x => x.FUserId == CurrentUser.FId); dic.Add("spaceteam", team); } return PartialView(dic);// View(dic); } }

     

    转载于:https://www.cnblogs.com/softmans/p/3303158.html

    你可能感兴趣的文章
    MyBatis-resultType 与 resultMap 中的几种返回类型
    查看>>
    Ubuntu16.04LTS中使用 apt-get install 出现错误 Could not get lock /var/lib/dpkg/lock 的解决方案...
    查看>>
    关于mongodb的aggregate
    查看>>
    Java创建线程的两个方法
    查看>>
    bootstrap 栅格系统 自动隐藏
    查看>>
    jps命令使用
    查看>>
    七、Springmvc拦截器
    查看>>
    FineUI下实现Enter键搜索功能
    查看>>
    JDownload: 一款可以从网络上下载文件的小程序第四篇(整体架构描述)
    查看>>
    mysql优化(一)
    查看>>
    resttemplate.postforobject
    查看>>
    python自动发送邮件
    查看>>
    shiro安全框架
    查看>>
    kafka简介及集群部署
    查看>>
    Mysql 安装时Mariadb冲突问题
    查看>>
    java IO流 之 字符流
    查看>>
    centos7安装nodejs
    查看>>
    笔记一 air android开发简介
    查看>>
    7月19号=》231页-240页
    查看>>
    eclipse svn知识
    查看>>