当前位置: 首页>>代码示例>>C#>>正文


C# SearchModel类代码示例

本文整理汇总了C#中SearchModel的典型用法代码示例。如果您正苦于以下问题:C# SearchModel类的具体用法?C# SearchModel怎么用?C# SearchModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SearchModel类属于命名空间,在下文中一共展示了SearchModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: List

        /* Creates the grid data */
        public ActionResult List(SearchParameter searchP, SearchModel searchModel)
        {            
            var model = _stores.AsQueryable();

            GridData data = model.ToGridData(searchModel, new[] { "Id", "Name", "Address" });
            return Json(data, JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:8,代码来源:EditingController.cs

示例2: TestSearchEmpty

 public void TestSearchEmpty()
 {
     SearchModel<Status> model = new SearchModel<Status>();
     SearchValidationResult res = model.IsValidSearchCombination();
     Assert.False(res.IsValid);
     Assert.AreEqual(StringResource.NO_VALUES_TO_SEARCH, res.Description);
 }
开发者ID:stampr,项目名称:stampr-api-csharp,代码行数:7,代码来源:SearchTest.cs

示例3: TestCombineSearch

        public void TestCombineSearch()
        {
            // create mock of MovieRepository and construct SearchHelper with it
              Mock<MovieRepository> repository = new Mock<MovieRepository>();
              repository.Setup(x => x.Select<MovieModel>()).Returns(movies.AsQueryable());
              SearchHelper searcher = new SearchHelper(repository.Object);

              // test cases

              //1
              SearchModel search1 = new SearchModel
              {
            MovieName = new SearchOption<string>(),
            Genre = new SearchOption<Genre>(),
            ActorLastName = new SearchOption<string>(),
              };
              List<MovieModel> result1 = searcher.Search(search1);
              Assert.IsTrue(result1.Count == 3);
              Assert.IsTrue(result1.Where(x => x.Name == movies[0].Name).Any());
              Assert.IsTrue(result1.Where(x => x.Name == movies[1].Name).Any());
              Assert.IsTrue(result1.Where(x => x.Name == movies[2].Name).Any());

              //2
              SearchModel search2 = new SearchModel
              {
            MovieName = new SearchOption<string>(),
            Genre = new SearchOption<Genre> { Value = Genre.Drammatic, IsCritical = true },
            ActorLastName = new SearchOption<string> { Value = "Стоун", IsCritical = true },
              };
              List<MovieModel> result2 = searcher.Search(search2);
              Assert.IsTrue(result2.Count == 1);
              Assert.IsTrue(result2.Where(x => x.Name == movies[1].Name).Any());
        }
开发者ID:pavelsavrovsky,项目名称:movie_search,代码行数:33,代码来源:SearchHelperTest.cs

示例4: Search

        public ActionResult Search(SearchModel model)
        {
            ITwitterClient twitterClient = new TwitterClient();
            var tweetRepository = new TweetPageRepository();
            var cachedPage = tweetRepository.GetPageBySearchString(model.HashtagToSearchFor, model.PageToRetrieve);
            if (cachedPage != null)
            {
                return PartialView(cachedPage.ToModel(model.PageToRetrieve, PAGE_SIZE, model.HashtagToSearchFor));
            }

            int twitterPage = (int)Math.Ceiling(model.PageToRetrieve / (float)PAGE_SIZE);

            var searchResults = twitterClient.SearchByHashtag(model.HashtagToSearchFor, CACHE_SIZE, twitterPage);
            int pageCount = (int)Math.Ceiling(searchResults.Count()/(decimal)PAGE_SIZE);
            int cachePageRangeStart = ((twitterPage - 1) * PAGE_SIZE) + 1;

            var searchResultPages = Enumerable.Range(0, pageCount)
                    .Select(pageNo => searchResults.Skip(pageNo * PAGE_SIZE).Take(PAGE_SIZE))
                    .Select((page, pageNo) => page.ToRepositoryContract(cachePageRangeStart + pageNo, PAGE_SIZE, model.HashtagToSearchFor));

            tweetRepository.ReplacePages(searchResultPages);

            var currentPageResult = searchResultPages.FirstOrDefault(page => page.Page == model.PageToRetrieve);
            return PartialView(currentPageResult.ToModel(model.PageToRetrieve, PAGE_SIZE, model.HashtagToSearchFor));
        }
开发者ID:JimmyHoffa,项目名称:20HourChallenge,代码行数:25,代码来源:MVCController.cs

示例5: SearchModule

        public SearchModule () 
        {
            Get ["/search"] = parameters => {
                SearchModel model = new SearchModel();
                model.Planeswalker = ((Planeswalker)this.Context.CurrentUser);
                model.ActiveMenu = "search";

                return View["Search", model];
            };

            Post ["/search"] = parameters => {
                SearchModel model = this.Bind<SearchModel>();
                model.Planeswalker = ((Planeswalker)this.Context.CurrentUser);
                UserCard [] walkerCards = null;

                try
                {
                    Card[] cards = magicdb.Search(model.Term);
                    model.ActiveMenu = "search";

                    cards = cards
                        .AsEnumerable()
                        .OrderBy(x => x.Name)
                        .ThenByDescending(x => x.ReleasedAt).ToArray();

                    if(model.Planeswalker != null)
                    {
                        int [] cardIds = cards.AsEnumerable().Select(c => c.Id).ToArray();
                        walkerCards = repository.GetUserCards(model.Planeswalker.Id,cardIds);
                    }

                    foreach(var c in cards)
                    {
                        CardInfo cardInfo = new CardInfo();

                        if(walkerCards != null && walkerCards.Length > 0)
                        {
                            cardInfo.Amount = walkerCards.AsEnumerable()
                                .Where(info => info.MultiverseId == c.Id)
                                .Select(info => info.Amount).FirstOrDefault();

                        }
                        else
                        {
                            cardInfo.Amount = 0;
                        }

                        cardInfo.Card = c;
                        model.Cards.Add(cardInfo);
                    }
                }
                catch(Exception e)
                {
                    model.Errors.Add(e.Message);
                }
               
                return View["Search", model];
            };
        }
开发者ID:jesseflorig,项目名称:www.mtgdb.info,代码行数:59,代码来源:SearchModule.cs

示例6: ChildList

        public ActionResult ChildList(int productId, SearchModel searchModel)
        {
            StoreRepository rep = new StoreRepository();
            List<Store> stores = rep.GetByProductId(productId);

            var model = stores.AsQueryable();
            return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "Address" }), JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:8,代码来源:HomeController.cs

示例7: SetSearch

 public void SetSearch(SearchModel searchRouter)
 {
     base.SetSearch(searchRouter);
     this.SearchBytitleCh = searchRouter.SearchBytitleCh;
     this.SearchBytitleEng = searchRouter.SearchBytitleEng;
     this.SearchByteacherName = searchRouter.SearchByteacherName;
     this.SearchBySkill = searchRouter.SearchBySkill;
 }
开发者ID:mcyang,项目名称:APISTest,代码行数:8,代码来源:fvmRDRManage.cs

示例8: Search

        public static IQueryable<RentCrib> Search(SearchModel queryParams)
        {
            Stack<Expression<Func<RentCrib, bool>>> filters = BuildFilters(queryParams);

            IQueryable<RentCrib> list = Db.RentCribs.Where(x => x.Active).OrderBy(x => x.DatePost);
            var filtered = ApplyFilters(list, filters);
            return filtered;
        }
开发者ID:goementhomiwa,项目名称:Cribs,代码行数:8,代码来源:CribSearch.cs

示例9: List

        public ActionResult List(SearchModel searchModel)
        {
            ProductRepository repository = new ProductRepository();

            List<Product> products = repository.ListAll();

            return Json(products.AsQueryable().ToGridData(searchModel, new[] { "Id", "Name", "CompanyName", "Price" }), JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:8,代码来源:HomeController.cs

示例10: List

        /* Notice the List methid accepts an additional
         * SearchParameter parameter - this is achieved using the -
         * Html.BuildQuery method used in the view Grid declaration */
        public ActionResult List(SearchParameter searchP, SearchModel searchModel)
        {
            StoreRepository repository = new StoreRepository();

            List<Store> stores = repository.ListAll();

            var model = stores.AsQueryable();
            return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "Address" }), JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:12,代码来源:SearchController.cs

示例11: Search

        public ActionResult Search(string name, string comm, string addr)
        {
            if (!Authenticate(checkOrgLeadersOnly: true))
                return Content("not authorized");
            Response.NoCache();

            var m = new SearchModel(name, comm, addr);
            return new SearchResult0(m.PeopleList(), m.Count());
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:9,代码来源:APIiPhoneController.cs

示例12: ListNodes

 /// <summary>
 /// grid显示函数
 /// </summary>
 /// <param name="searchModel">grid搜索模型</param>
 /// <returns>程序功能节点</returns>
 public ActionResult ListNodes(SearchModel searchModel)
 {
     IQueryable<GeneralProgNode> oPrograms = dbEntity.GeneralProgNodes.Include("Name").Where(p => p.Deleted == false && p.ProgID == progNodeGidGrid).AsQueryable();
     GridColumnModelList<GeneralProgNode> columns = new GridColumnModelList<GeneralProgNode>();
     columns.Add(p => p.Gid).SetAsPrimaryKey();
     columns.Add(p => p.Code);
     columns.Add(p => p.Name.GetResource(CurrentSession.Culture)).SetName("Name.Matter");
     columns.Add(p => (p.Optional == null) ? "": p.Optional.GetResource(CurrentSession.Culture)).SetName("Optional.Matter");
     GridData gridData = oPrograms.ToGridData(searchModel, columns);
     return Json(gridData, JsonRequestBehavior.AllowGet);
 }
开发者ID:NH4CL,项目名称:UniProject,代码行数:16,代码来源:ProgramController.cs

示例13: Index

        public ActionResult Index(FormCollection form  )
        {
            var model = new SearchModel { City = form["City"], Zip = form["Zip"], };
            if (ModelState.IsValid)
            {

                return RedirectToAction("Index", "Results");
            }
            ModelState.AddModelError(string.Empty, "Oops,  " + string.Join(" ; ", ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage)));
            return View(model);
        }
开发者ID:tosca,项目名称:Hyatt,代码行数:11,代码来源:SearchController.cs

示例14: ListPersons

        /* Creates the grid data */
        public ActionResult ListPersons(SearchModel searchModel)
        {
            List<Person> stores = _persons;

            IQueryable<Person> model =
                (from Person p in stores
                select p).AsQueryable();

            GridData gridData = model.ToGridData(searchModel, Columns.PersonColumns);

            return Json(gridData, JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:13,代码来源:RenderersController.cs

示例15: SearchResults

        public ActionResult SearchResults(string name, string comm, string addr)
        {
            if (!Authenticate(checkOrgLeadersOnly: true))
                return Content("not authorized");
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Access"))
                return Content("not authorized");
            Response.NoCache();

            DbUtil.LogActivity($"iphone search '{name}'");
            var m = new SearchModel(name, comm, addr);
            return new SearchResult(m.PeopleList(), m.Count());
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:12,代码来源:APIiPhoneController.cs


注:本文中的SearchModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。