コード例 #1
0
        public void searchTest()
        {
            var vo = new SearchFilterVm();
            vo.keyword = "one";
            var res = businessManager.search(vo);

            if (res != null)
               {
                Assert.IsTrue(true);
            }
            else Assert.IsTrue(false);
        }
コード例 #2
0
        public SearchFilterVm search(SearchFilterVm input)
        {
            using (var db = new MainDb())
            {
                var query = db.listings
                             .OrderByDescending(b => b.created)
                             .Where(e => (input.isActive == null || e.isActive == input.isActive)
                                      && (e.title.Contains(input.keyword) || string.IsNullOrEmpty(input.keyword))
                                    );

              if (input.paging != null) {
                     input.paging.totalCount = query.Count();
                     query =query
                             .Skip(input.paging.skip)
                             .Take(input.paging.rowCount);

                 }

                input.result = query.ToList<object>();

                return input;
            }
        }