Esempio n. 1
0
        /// <summary>
        /// 我的关注
        /// </summary>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <param name="username"></param>
        /// <param name="realname"></param>
        /// <param name="sex"></param>
        /// <returns></returns>
        public JsonResult GetMyAttentions(int pageIndex, int pageSize, string username, string realname, int sex)
        {
            var allattentioins = shipService.GetAttentions(CurrentUser.UserId);
            var query          = SystemUsers.AsQueryable().Where(p => p.Status == 0 && allattentioins.Contains(p.UserId))
                                 .Where(p => p.Username.ToLower().Contains(username.ToLower()))
                                 .Where(p => p.Realname.ToLower().Contains(realname.ToLower()))
                                 .Where(p => sex == -1 || sex == p.Sex);
            var total    = query.Count();
            var dataList = query.Skip((pageIndex - 1) * pageSize).Take(pageSize).Select(p => new
            {
                p.UserId,
                p.Username,
                p.Realname,
                p.Signature,
                p.photoUrl
            });

            return(Json(new { dataList, recordCount = total }, JsonRequestBehavior.AllowGet));
        }