博客
关于我
强烈建议你试试无所不能的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

    你可能感兴趣的文章
    一句话说清分布式锁,进程锁,线程锁
    查看>>
    python常用函数
    查看>>
    FastDFS使用
    查看>>
    服务器解析请求的基本原理
    查看>>
    [HDU3683 Gomoku]
    查看>>
    【工具相关】iOS-Reveal的使用
    查看>>
    数据库3
    查看>>
    存储分类
    查看>>
    下一代操作系统与软件
    查看>>
    【iOS越狱开发】如何将应用打包成.ipa文件
    查看>>
    [NOIP2013提高组] CODEVS 3287 火车运输(MST+LCA)
    查看>>
    Yii2 Lesson - 03 Forms in Yii
    查看>>
    Python IO模型
    查看>>
    Ugly Windows
    查看>>
    DataGridView的行的字体颜色变化
    查看>>
    Java再学习——关于ConcurrentHashMap
    查看>>
    如何处理Win10电脑黑屏后出现代码0xc0000225的错误?
    查看>>
    局域网内手机访问电脑网站注意几点
    查看>>
    [Serializable]的应用--注册码的生成,加密和验证
    查看>>
    Day19内容回顾
    查看>>