Beispiel #1
0
        public void OnGet(string searchKey, Direction?direction)
        {
            Direction   = direction;
            UserContext = CoreService.GetUserContext();

            TradeQuery = DbContext.Trades
                         .Include(t => t.VetMember)
                         .Where(c => c.TradeStatus != TradeStatus.Cancel)
                         .AsQueryable();

            if (UnderRewordLimit.HasValue)
            {
                TradeQuery = TradeQuery
                             .Where(c => c.Reward >= UnderRewordLimit || c.Reward == null);
            }

            if (OverRewordLimit.HasValue)
            {
                TradeQuery = TradeQuery
                             .Where(c => c.Reward <= OverRewordLimit || c.Reward == null);
            }

            if (IsExceptRewardNull)
            {
                TradeQuery = TradeQuery
                             .Where(c => c.Reward != null);
            }

            if (!IsWorking)
            {
                TradeQuery = TradeQuery.Where(c => !c.Contracts.Any(d => d.ContractStatus == ContractStatus.Working || d.ContractStatus == ContractStatus.Deliveryed));
            }
            if (!IsCpmplited)
            {
                TradeQuery = TradeQuery.Where(c => !c.Contracts.Any(d => d.ContractStatus == ContractStatus.Complete) || c.IsContinued);
            }

            if (direction.HasValue)
            {
                TradeQuery = TradeQuery.Where(c => c.Direction == direction);
            }

            if (!string.IsNullOrEmpty(searchKey))
            {
                TradeQuery = TradeQuery
                             .Where(c =>
                                    c.Title.Contains(searchKey) ||
                                    c.Content.Contains(searchKey) ||
                                    c.VetMember.Name.Contains(searchKey));
            }

            Response.Cookies.Append("Test", "{ a:'BBB'}");
        }
Beispiel #2
0
        public void OnGet(string searchKey, Direction?direction)
        {
            Direction = direction;

            TradeQuery = DbContext.Trades
                         .Include(t => t.VetMember)
                         .Where(c => c.TradeStatus != TradeStatus.Cancel)
                         .AsQueryable();


            if (direction.HasValue)
            {
                TradeQuery = TradeQuery.Where(c => c.Direction == direction);
            }

            if (!string.IsNullOrEmpty(searchKey))
            {
                TradeQuery = TradeQuery
                             .Where(c =>
                                    c.Title.Contains(searchKey) ||
                                    c.Content.Contains(searchKey) ||
                                    c.VetMember.Name.Contains(searchKey));
            }
        }