コード例 #1
0
ファイル: HomeAppService.cs プロジェクト: Kiddingzzz/GroupBY
        /// <summary>
        ///获取租房源列表
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public Task <PagedResultDto <HouseOutput> > GetBorrowBuildList(buildInput input)
        {
            var query = from a in _homeListRepository.Where(a => a.HouseStatu == "租")
                        join b in _houseInformationRepository on a.Id equals b.HomeListId
                        join c in _ownerInforRepository on a.Id equals c.HomeListId
                        select new HouseOutput
            {
                Id               = a.Id,
                Housecode        = a.Housecode,
                HouseStatu       = a.HouseStatu,
                Pianqu           = a.Pianqu,
                BuildName        = a.BuildName,
                BuildUnit        = a.BuildUnit,
                BuildNumber      = a.BuildNumber,
                BuildFoolr       = a.BuildFoolr,
                BuildArea        = a.BuildArea,
                Orientation      = a.Orientation,
                Renovation       = a.Renovation,
                Purpose          = a.Purpose,
                Price            = b.Price,
                RecentMoney      = b.RecentMoney,
                MonthRecentMoney = b.MonthRecentMoney,
                LoginName        = b.LoginName,
                JXWPerson        = a.JXWPerson,
            };

            query = query.WhereIf(!input.SearchName.IsNullOrEmpty(), t => t.BuildName.Contains(input.SearchName))
                    .WhereIf(!input.SearchName.IsNullOrEmpty(), t => t.LoginName.Contains(input.SearchName))
                    .WhereIf(!input.SearchName.IsNullOrEmpty(), t => t.Pianqu.Contains(input.SearchName));
            var result = query.OrderByDescending(t => t.CreationTime).PageBy(input).ToList();

            return(Task.FromResult(new PagedResultDto <HouseOutput>(query.Count(), result)));
        }
コード例 #2
0
ファイル: HomeAppService.cs プロジェクト: Kiddingzzz/GroupBY
        /// <summary>
        ///获取售房源列表
        /// </summary>
        /// <param name="output"></param>
        /// <returns></returns>
        public async Task <ListResultDto <HouseOutput> > GetSaleBuildList(buildInput input)
        {
            var query = from a in _homeListRepository.Where(a => a.HouseStatu == "售")
                        join b in _houseInformationRepository on a.Id equals b.HomeListId
                        join c in _ownerInforRepository on a.Id equals c.HomeListId
                        select new HouseOutput
            {
                Id               = a.Id,
                Housecode        = a.Housecode,
                HouseStatu       = a.HouseStatu,
                Pianqu           = a.Pianqu,
                BuildName        = a.BuildName,
                BuildUnit        = a.BuildUnit,
                BuildNumber      = a.BuildNumber,
                BuildFoolr       = a.BuildFoolr,
                BuildArea        = a.BuildArea,
                Orientation      = a.Orientation,
                Renovation       = a.Renovation,
                Purpose          = a.Purpose,
                Price            = b.Price,
                RecentMoney      = b.RecentMoney,
                MonthRecentMoney = b.MonthRecentMoney,
                LoginName        = b.LoginName,
                JXWPerson        = a.JXWPerson,
                OwnerName        = c.OwnerName,
                phoneNumber1     = c.phoneNumber1,
            };

            query = query.WhereIf(!input.SearchName.IsNullOrEmpty(),
                                  t => t.LoginName.Contains(input.SearchName) ||
                                  t.BuildName.Contains(input.SearchName) ||
                                  t.Pianqu.Contains(input.SearchName) ||
                                  t.OwnerName.Contains(input.SearchName) ||
                                  t.phoneNumber1.Contains(input.SearchName)
                                  );
            return(new ListResultDto <HouseOutput>(query.ToList()));
        }