/// <summary>
        /// 获取活动评论
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <IActionResult> GetComments(Guid id, string listPageParaJson)
        {
            var listPagePara = new ListPageParameter();

            if (listPageParaJson != null)
            {
                listPagePara = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            }

            ViewBag.activityId = id;
            //获取一级评论
            var commentList = await _commonExtension.GetAll().OrderByDescending(x => x.CommentDataTime).Include(x => x.Activity).Include(x => x.User).Include(x => x.User.Avatar).Where(x => x.Activity.ID == id && x.ParentGrade == null).ToListAsync();

            var comments = new List <CommentVM>();

            foreach (var item in commentList)
            {
                var commentVM = new CommentVM(item);
                commentVM.CommentChildrens = await _commonExtension.GetAll().OrderBy(x => x.CommentDataTime).Include(x => x.Activity).Include(x => x.AcceptUser).Include(x => x.User).Include(x => x.User.Avatar).Where(x => x.ParentGrade == item.ID).ToListAsync();

                comments.Add(commentVM);
            }
            var commentPageList    = IQueryableExtensions.ToPaginatedList(comments.AsQueryable(), listPagePara.PageIndex, listPagePara.PageSize);
            var commentCollections = new List <CommentVM>();

            foreach (var commentTermPage in commentPageList)
            {
                commentCollections.Add(commentTermPage);
            }
            var pageGroup = PagenateGroupRepository.GetItem(commentPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/BusinessView/ActivityTermView/_GetComments.cshtml", commentCollections));
        }
        public async Task <IActionResult> List(string keywork, string probably, string listPageParaJson)
        {
            var listPagePara = new ListPageParameter();

            if (listPageParaJson != null)
            {
                listPagePara = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            }
            var atCollection = new List <ActivityTerm>();

            if (!String.IsNullOrEmpty(keywork))
            {
                Expression <Func <ActivityTerm, bool> > condtion = x =>
                                                                   x.Name.Contains(keywork) ||
                                                                   x.User.Name.Contains(keywork) ||
                                                                   x.AnAssociation.Name.Contains(keywork) ||
                                                                   x.Address.Contains(keywork);
                atCollection = await _activityTermExtension.GetAll().Include(x => x.User).Include(x => x.AnAssociation).Include(x => x.Avatar).Where(condtion).Where(x => x.Status == ActivityStatus.未开始 && x.IsDisable).ToListAsync();

                if (probably == "1")
                {
                    atCollection = atCollection.Where(x => x.AnAssociation != null).ToList();
                }
                else if (probably == "2")
                {
                    atCollection = atCollection.Where(x => x.User != null && x.AnAssociation == null).ToList();
                }
            }
            else
            {
                atCollection = await _activityTermExtension.GetAll().Include(x => x.User).Include(x => x.AnAssociation).Include(x => x.Avatar).Where(x => x.Status == ActivityStatus.未开始 && x.IsDisable).ToListAsync();

                if (probably == "1")
                {
                    atCollection = atCollection.Where(x => x.AnAssociation != null).ToList();
                }
                else if (probably == "2")
                {
                    atCollection = atCollection.Where(x => x.User != null && x.AnAssociation == null).ToList();
                }
            }
            var activityTermPageList = IQueryableExtensions.ToPaginatedList(atCollection.AsQueryable(), listPagePara.PageIndex, 12);

            var activityCollections = new List <ActivityTermVM>();

            foreach (var activityTermPage in activityTermPageList)
            {
                activityCollections.Add(new ActivityTermVM(activityTermPage)
                {
                    EnteredNumber = (await _activityUserExtension.GetAll().Where(x => x.ActivityTermId == activityTermPage.ID).ToListAsync()).Count
                });
            }

            var pageGroup = PagenateGroupRepository.GetItem(activityTermPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/BusinessView/ActivityTermView/_List.cshtml", activityCollections));
        }
        /// <summary>
        /// 根据关键词检索人员数据集合,返回给前端页面
        /// </summary>
        /// <param name="keywork"></param>
        /// <returns></returns>
        public async Task <IActionResult> List(string keywork, string listPageParaJson, string pageIndex)
        {
            var listPagePara = new ListPageParameter();

            if (listPageParaJson != null && listPageParaJson != "")
            {
                listPagePara = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            }
            listPagePara.PageIndex = Convert.ToInt32(pageIndex);
            var boVMCollection = new List <ApplicationUserVM>();

            if (!String.IsNullOrEmpty(keywork) && keywork != "undefined")
            {
                Expression <Func <ApplicationUser, bool> > condtion = x =>//Contains(参数字符串是否包含于string对象中)
                                                                      x.Name.Contains(keywork) ||
                                                                      x.SchoolAddress.Contains(keywork) ||
                                                                      x.School.Contains(keywork);
                var userCollection = await _userExtension.GetAll().Include(x => x.Avatar).Where(condtion).OrderByDescending(x => x.RegisterTime).ToListAsync();

                foreach (var bo in userCollection)
                {
                    boVMCollection.Add(new ApplicationUserVM(bo));
                }
            }
            else
            {
                var userCollection = await _userExtension.GetAll().Include(x => x.Avatar).OrderByDescending(x => x.RegisterTime).ToListAsync();

                foreach (var bo in userCollection)
                {
                    boVMCollection.Add(new ApplicationUserVM(bo));
                }
            }

            var userCollectionPageList = IQueryableExtensions.ToPaginatedList(boVMCollection.AsQueryable <ApplicationUserVM>(), listPagePara.PageIndex, listPagePara.PageSize);

            var userCollections = new List <ApplicationUserVM>();

            foreach (var userCollection in userCollectionPageList)
            {
                userCollections.Add(userCollection);
            }
            var pageGroup = PagenateGroupRepository.GetItem <ApplicationUserVM>(userCollectionPageList, 3, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/ApplicationOrganization/ApplicationUser/_List.cshtml", userCollections));
        }
Example #4
0
        public async Task <IActionResult> Index()
        {
            var anCollection = await _anAssociationExtension.GetAllIncludingAsyn(x => x.User);

            var anVmCollection = new List <AnAssociationVM>();

            foreach (var an in anCollection)
            {
                var anVM = new AnAssociationVM(an);
                anVmCollection.Add(anVM);
            }

            var pageSize          = 10;
            var pageIndex         = 1;
            var anAssociationList = anVmCollection.OrderBy(x => x.Name).FirstOrDefault();

            //处理分页

            var anAssociationCollectionPageList = IQueryableExtensions.ToPaginatedList(anVmCollection.AsQueryable <AnAssociationVM>(), pageIndex, pageSize);
            var anAssociationCollections        = new List <AnAssociationVM>();

            foreach (var anAssociationCollection in anAssociationCollectionPageList)
            {
                anAssociationCollections.Add(anAssociationCollection);
            }

            //提取当前分页关联的分页器实例
            var pageGroup = PagenateGroupRepository.GetItem(anAssociationCollectionPageList, 5, pageIndex);

            ViewBag.PageGroup = pageGroup;

            var listPageParameter = new ListPageParameter()
            {
                PageIndex        = anAssociationCollectionPageList.PageIndex,
                Keyword          = "",
                PageSize         = anAssociationCollectionPageList.PageSize,
                ObjectTypeID     = "",
                ObjectAmount     = anAssociationCollectionPageList.TotalCount,
                SortDesc         = "Default",
                SortProperty     = "UserName",
                PageAmount       = 0,
                SelectedObjectID = ""
            };

            ViewBag.PageParameter = listPageParameter;
            return(View("~/Views/GroupOrganization/AnAssociation/Index.cshtml", anAssociationCollections));
        }
Example #5
0
        public async Task <IActionResult> OrderList(string selectNnm)
        {
            ViewBag.UserLogonInformation = GetUserName();
            var listPagePara = new ListPageParameter()
            {
                ObjectTypeID     = "Order",    // 对应的归属类型ID
                PageIndex        = 1,          // 当前页码
                PageSize         = 4,          // 每页数据条数 为"0"时显示所有
                PageAmount       = 0,          // 相关对象列表分页处理分页数量
                ObjectAmount     = 0,          // 相关的对象的总数
                Keyword          = "",         // 当前的关键词
                SortProperty     = "SortCode", // 排序属性
                SortDesc         = "default",  // 排序方向,缺省值正向 Default,前端用开关方式转为逆向:Descend
                SelectedObjectID = "",         // 当前页面处理中处理的焦点对象 ID
                IsSearch         = false,      // 当前是否为检索
            };

            listPagePara.PageIndex = selectNnm != null?Convert.ToInt32(selectNnm) : 1;

            var user = User.Claims.FirstOrDefault();

            if (user.Value == new Guid().ToString())
            {
                return(View("../../Views/Home/Logon"));
            }
            var shop = _ShopRepository.GetSingleBy(x => x.ShopForUser.Id == user.Value);
            //查询订单详细所关联的商品列表
            var orderItems     = _OrderItemRepository.FindBy(x => x.ShopName == shop.Name); //获取订单和订单对应的用户和商品
            var orVMCollection = new List <SK_WM_OrderItemVM>();                            //存放用户所有订单

            var OrderAll = orderItems.AsQueryable <SK_WM_OrderItem>();
            var OrderCollectionPageList = IQueryableExtensions.ToPaginatedList(OrderAll, listPagePara.PageIndex, listPagePara.PageSize);

            foreach (var order in OrderCollectionPageList)
            {
                var omVM = new SK_WM_OrderItemVM(order);
                orVMCollection.Add(omVM);
            }

            var pageGroup = PagenateGroupRepository.GetItem <SK_WM_OrderItem>(OrderCollectionPageList, 3, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;

            return(View("../../Views/BusinessOrganization/BusinessBG/OrderList", orVMCollection));
        }
Example #6
0
        public async Task <IActionResult> Index()
        {
            var atCollection = await _activityTermExtension.GetAll().OrderBy(x => x.Status).ThenByDescending(x => x.CreateDateTime).Include(x => x.User).ToListAsync();

            var atVmCollection = new List <ActivityTermVM>();

            foreach (var at in atCollection)
            {
                var atVM = new ActivityTermVM(at);
                atVmCollection.Add(atVM);
            }

            var pageSize                = 10;
            var pageIndex               = 1;
            var activityTermList        = atVmCollection.FirstOrDefault();
            var activityTermCollections = new List <ActivityTermVM>();
            //处理分页

            var activityTermCollectionPageList = IQueryableExtensions.ToPaginatedList(atVmCollection.AsQueryable <ActivityTermVM>(), pageIndex, pageSize);

            foreach (var activityTermCollection in activityTermCollectionPageList)
            {
                activityTermCollections.Add(activityTermCollection);
            }

            //提取当前分页关联的分页器实例
            var pageGroup = PagenateGroupRepository.GetItem(activityTermCollectionPageList, 5, pageIndex);

            ViewBag.PageGroup = pageGroup;

            var listPageParameter = new ListPageParameter()
            {
                PageIndex        = activityTermCollectionPageList.PageIndex,
                Keyword          = "",
                PageSize         = activityTermCollectionPageList.PageSize,
                ObjectTypeID     = "",
                ObjectAmount     = activityTermCollectionPageList.TotalCount,
                SortDesc         = "Default",
                SortProperty     = "Name",
                PageAmount       = 0,
                SelectedObjectID = ""
            };

            ViewBag.PageParameter = listPageParameter;
            return(View("~/Views/GroupOrganization/ActivityTerm/Index.cshtml", activityTermCollections));
        }
Example #7
0
        public async Task <IActionResult> Index()
        {
            var boCollection = await _PersonExtension.GetAllAsyn();

            var boVMCollection = new List <PersonVM>();

            foreach (var bo in boCollection)
            {
                var boVM = new PersonVM(bo);
                boVMCollection.Add(boVM);
            }
            var pageSize   = 10;
            var pageIndex  = 1;
            var personList = boVMCollection.OrderBy(x => x.Name).FirstOrDefault();
            // 处理分页
            var personCollectionPageList = IQueryableExtensions.ToPaginatedList(boVMCollection.AsQueryable <PersonVM>(), pageIndex, pageSize);
            var personCollections        = new List <PersonVM>();

            foreach (var personCollection in personCollectionPageList)
            {
                personCollections.Add(personCollection);
            }

            //提取当前分页关联的分页器实例
            var pageGroup = PagenateGroupRepository.GetItem <PersonVM>(personCollectionPageList, 3, pageIndex);

            ViewBag.PageGroup = pageGroup;

            var listPageParameter = new ListPageParameter()
            {
                PageIndex        = personCollectionPageList.PageIndex,
                Keyword          = "",
                PageSize         = personCollectionPageList.PageSize,
                ObjectTypeID     = "",
                ObjectAmount     = personCollectionPageList.TotalCount,
                SortDesc         = "Default",
                SortProperty     = "UserName",
                PageAmount       = 0,
                SelectedObjectID = ""
            };

            ViewBag.PageParameter = listPageParameter;
            return(View("~/Views/BusinessOrganization/Person/Index.cshtml", personCollections));
        }
Example #8
0
        public async Task <IActionResult> Index()
        {
            var boCollection = await _hobbyExtension.GetAll().Include(x => x.Avatar).OrderBy(x => x.SortCode).ToListAsync();

            var boVMCollection = new List <HobbyVM>();

            foreach (var bo in boCollection)
            {
                var boVM = new HobbyVM(bo);
                boVMCollection.Add(boVM);
            }
            var pageSize   = 10;
            var pageIndex  = 1;
            var personList = boVMCollection.OrderBy(x => x.Name).FirstOrDefault();
            // 处理分页
            var hobbyCollectionPageList = IQueryableExtensions.ToPaginatedList(boVMCollection.AsQueryable <HobbyVM>(), pageIndex, pageSize);
            var hobbyCollections        = new List <HobbyVM>();

            foreach (var hobbyCollection in hobbyCollectionPageList)
            {
                hobbyCollections.Add(hobbyCollection);
            }

            //提取当前分页关联的分页器实例
            var pageGroup = PagenateGroupRepository.GetItem <HobbyVM>(hobbyCollectionPageList, 5, pageIndex);

            ViewBag.PageGroup = pageGroup;

            var listPageParameter = new ListPageParameter()
            {
                PageIndex        = hobbyCollectionPageList.PageIndex,
                Keyword          = "",
                PageSize         = hobbyCollectionPageList.PageSize,
                ObjectTypeID     = "",
                ObjectAmount     = hobbyCollectionPageList.TotalCount,
                SortDesc         = "Default",
                SortProperty     = "Name",
                PageAmount       = 0,
                SelectedObjectID = ""
            };

            ViewBag.PageParameter = listPageParameter;
            return(View("~/Views/ApplicationOrganization/Hobbys/Index.cshtml", hobbyCollections));
        }
Example #9
0
        public async Task <IActionResult> List(string keywork, string listPageParaJson)
        {
            var listPagePara = new ListPageParameter();

            if (listPageParaJson != null)
            {
                listPagePara = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            }
            var anCollection = new List <AnAssociation>();

            if (!String.IsNullOrEmpty(keywork))
            {
                Expression <Func <AnAssociation, bool> > condtion = x =>
                                                                    x.Name.Contains(keywork) ||
                                                                    x.User.Name.Contains(keywork) ||
                                                                    x.SchoolAddress.Contains(keywork);
                anCollection = await _anAssociationExtension.GetAll().Include(x => x.User).Include(x => x.Avatar).Where(condtion).Where(x => x.IsDisable).ToListAsync();
            }
            else
            {
                anCollection = await _anAssociationExtension.GetAll().Include(x => x.User).Include(x => x.Avatar).Where(x => x.IsDisable).ToListAsync();
            }
            var activityTermPageList = IQueryableExtensions.ToPaginatedList(anCollection.AsQueryable(), listPagePara.PageIndex, 12);

            var anAssociationCollections = new List <AnAssociationVM>();

            foreach (var activityTermPage in activityTermPageList)
            {
                var anNum = await _anAssociationAndUserExtension.GetAll().Where(x => x.AnAssociationId == activityTermPage.ID).Select(x => x.AnAssociation).ToListAsync();

                anAssociationCollections.Add(new AnAssociationVM(activityTermPage)
                {
                    AnAssociationNum = anNum.Count()
                });
            }

            var pageGroup = PagenateGroupRepository.GetItem(activityTermPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/BusinessView/AnAssociationView/_List.cshtml", anAssociationCollections));
        }
Example #10
0
        /// <summary>
        /// 根据关键词检索活动数据集合,返回给前端页面
        /// </summary>
        /// <param name="keywork"></param>
        public async Task <IActionResult> List(string keywork, string listPageParaJson)
        {
            var listPagePara   = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            var anVMCollection = new List <AnAssociationVM>();

            if (!String.IsNullOrEmpty(keywork) && keywork != "undefined")
            {
                Expression <Func <AnAssociation, bool> > condtion = x =>
                                                                    x.Name.Contains(keywork) ||
                                                                    x.SchoolAddress.Contains(keywork);
                var anAssociationCollection = await _anAssociationExtension.GetAll().Include(x => x.User).Where(condtion).ToListAsync();

                foreach (var an in anAssociationCollection)
                {
                    anVMCollection.Add(new AnAssociationVM(an));
                }
            }
            else
            {
                var anAssociationCollection = await _anAssociationExtension.GetAllIncludingAsyn(x => x.User);

                foreach (var an in anAssociationCollection)
                {
                    anVMCollection.Add(new AnAssociationVM(an));
                }
            }
            var anAssociationPageList = IQueryableExtensions.ToPaginatedList(anVMCollection.AsQueryable(), listPagePara.PageIndex, listPagePara.PageSize);

            var associationCollections = new List <AnAssociationVM>();

            foreach (var anAssociationPage in anAssociationPageList)
            {
                associationCollections.Add(anAssociationPage);
            }

            var pageGroup = PagenateGroupRepository.GetItem(anAssociationPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/GroupOrganization/AnAssociation/_List.cshtml", associationCollections));
        }
Example #11
0
        /// <summary>
        /// 根据关键词检索人员数据集合,返回给前端页面
        /// </summary>
        /// <param name="keywork"></param>
        /// <returns></returns>
        public async Task <IActionResult> List(string keywork, string listPageParaJson)
        {
            var listPagePara   = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            var boVMCollection = new List <PersonVM>();

            if (!String.IsNullOrEmpty(keywork))
            {
                Expression <Func <Person, bool> > condtion = x =>//Contains(参数字符串是否包含于string对象中)
                                                             x.Name.Contains(keywork) ||
                                                             x.FixedTelephone.Contains(keywork);
                var personCollection = await _PersonExtension.FindByAsyn(condtion);

                foreach (var bo in personCollection)
                {
                    boVMCollection.Add(new PersonVM(bo));
                }
            }
            else
            {
                var personCollection = await _PersonExtension.GetAllAsyn();

                foreach (var bo in personCollection)
                {
                    boVMCollection.Add(new PersonVM(bo));
                }
            }

            var personCollectionPageList = IQueryableExtensions.ToPaginatedList(boVMCollection.AsQueryable <PersonVM>(), listPagePara.PageIndex, listPagePara.PageSize);

            var personCollections = new List <PersonVM>();

            foreach (var personCollection in personCollectionPageList)
            {
                personCollections.Add(personCollection);
            }
            var pageGroup = PagenateGroupRepository.GetItem <PersonVM>(personCollectionPageList, 3, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("../../Views/BusinessOrganization/Person/_List", personCollections));
        }
Example #12
0
        /// <summary>
        /// 根据关键词检索爱好数据集合,返回给前端页面
        /// </summary>
        /// <param name="keywork"></param>
        /// <returns></returns>
        public async Task <IActionResult> List(string keywork, string listPageParaJson)
        {
            var listPagePara   = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            var boVMCollection = new List <HobbyVM>();

            if (!String.IsNullOrEmpty(keywork))
            {
                Expression <Func <Hobby, bool> > condtion = x =>//Contains(参数字符串是否包含于string对象中)
                                                            x.Name.Contains(keywork) ||
                                                            x.Description.Contains(keywork);
                var hobbyCollection = await _hobbyExtension.GetAll().Include(x => x.Avatar).OrderBy(x => x.SortCode).Where(condtion).ToListAsync();

                foreach (var bo in hobbyCollection)
                {
                    boVMCollection.Add(new HobbyVM(bo));
                }
            }
            else
            {
                var hobbyCollection = await _hobbyExtension.GetAll().Include(x => x.Avatar).OrderBy(x => x.SortCode).ToListAsync();

                foreach (var bo in hobbyCollection)
                {
                    boVMCollection.Add(new HobbyVM(bo));
                }
            }

            var hobbyCollectionPageList = IQueryableExtensions.ToPaginatedList(boVMCollection.AsQueryable <HobbyVM>(), listPagePara.PageIndex, listPagePara.PageSize);

            var hobbyCollections = new List <HobbyVM>();

            foreach (var hoCollection in hobbyCollectionPageList)
            {
                hobbyCollections.Add(hoCollection);
            }
            var pageGroup = PagenateGroupRepository.GetItem <HobbyVM>(hobbyCollectionPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/ApplicationOrganization/Hobbys/_List.cshtml", hobbyCollections));
        }
Example #13
0
        /// <summary>
        /// 根据关键词检索活动数据集合,返回给前端页面
        /// </summary>
        /// <param name="keywork"></param>
        public async Task <IActionResult> List(string keywork, string listPageParaJson)
        {
            var listPagePara   = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            var atVMCollection = new List <ActivityTermVM>();

            if (!String.IsNullOrEmpty(keywork) && keywork != "undefined")
            {
                Expression <Func <ActivityTerm, bool> > condtion = x =>
                                                                   x.Name.Contains(keywork) ||
                                                                   x.Address.Contains(keywork);
                var activityTermCollection = await _activityTermExtension.GetAll().OrderBy(x => x.Status).ThenByDescending(x => x.CreateDateTime).Include(x => x.User).Where(condtion).ToListAsync();

                foreach (var at in activityTermCollection)
                {
                    atVMCollection.Add(new ActivityTermVM(at));
                }
            }
            else
            {
                var activityTermCollection = await _activityTermExtension.GetAll().OrderBy(x => x.Status).ThenByDescending(x => x.CreateDateTime).Include(x => x.User).ToListAsync();

                foreach (var at in activityTermCollection)
                {
                    atVMCollection.Add(new ActivityTermVM(at));
                }
            }
            var activityTermPageList = IQueryableExtensions.ToPaginatedList(atVMCollection.AsQueryable(), listPagePara.PageIndex, listPagePara.PageSize);

            var activityCollections = new List <ActivityTermVM>();

            foreach (var activityTermPage in activityTermPageList)
            {
                activityCollections.Add(activityTermPage);
            }

            var pageGroup = PagenateGroupRepository.GetItem(activityTermPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/GroupOrganization/ActivityTerm/_List.cshtml", activityCollections));
        }
        public async Task <IActionResult> List(string keywork, string listPageParaJson)
        {
            var listPagePara = new ListPageParameter();

            if (listPageParaJson != null && listPageParaJson != "")
            {
                listPagePara = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            }
            var heVMCollection           = new List <HomeExhibitionVM>();
            var homeExhibitionCollection = new List <HomeExhibition>();

            if (!String.IsNullOrEmpty(keywork))
            {
                Expression <Func <HomeExhibition, bool> > condtion = x =>
                                                                     x.Name.Contains(keywork) ||
                                                                     x.Activity.Name.Contains(keywork) ||
                                                                     x.Activity.User.Name.Contains(keywork);
                homeExhibitionCollection = await _homeExhibitionRepository.GetAll().Include(x => x.Activity).Include(x => x.Activity.User).
                                           Include(x => x.Avatar).Where(condtion).OrderBy(x => x.CreateDateTime).ToListAsync();
            }
            else
            {
                homeExhibitionCollection = await _homeExhibitionRepository.GetAll().Include(x => x.Activity).Include(x => x.Activity.User).
                                           Include(x => x.Avatar).OrderBy(x => x.CreateDateTime).ToListAsync();
            }

            var homeExhibitionPageList = IQueryableExtensions.ToPaginatedList(homeExhibitionCollection.AsQueryable(), listPagePara.PageIndex, listPagePara.PageSize);

            foreach (var item in homeExhibitionPageList)
            {
                heVMCollection.Add(new HomeExhibitionVM(item));
            }
            var pageGroup = PagenateGroupRepository.GetItem(homeExhibitionPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/GroupOrganization/HomeExhibition/_List.cshtml", heVMCollection));
        }
Example #15
0
        /// <summary>
        /// 社团活动
        /// </summary>
        /// <param name="keywork"></param>
        /// <param name="listPageParaJson"></param>
        /// <returns></returns>
        public async Task <IActionResult> ActivityList(Guid id, string listPageParaJson)
        {
            var listPagePara = new ListPageParameter();

            if (listPageParaJson != null)
            {
                listPagePara = Newtonsoft.Json.JsonConvert.DeserializeObject <ListPageParameter>(listPageParaJson);
            }
            var atVMCollection         = new List <ActivityTermVM>();
            var activityTermCollection = await _activityTermExtension.GetAll().Include(x => x.User).Include(x => x.AnAssociation).Include(x => x.Avatar).Where(x => x.AnAssociation.ID == id).ToListAsync();

            var activityTermPageList = IQueryableExtensions.ToPaginatedList(activityTermCollection.AsQueryable(), listPagePara.PageIndex, 10);
            var activityCollections  = new List <ActivityTermVM>();

            foreach (var activityTermPage in activityTermPageList)
            {
                activityCollections.Add(new ActivityTermVM(activityTermPage));
            }
            var pageGroup = PagenateGroupRepository.GetItem(activityTermPageList, 5, listPagePara.PageIndex);

            ViewBag.PageGroup     = pageGroup;
            ViewBag.PageParameter = listPagePara;
            return(View("~/Views/GroupOrganization/AnAssociation/ActivityList.cshtml", activityCollections));
        }