public IEnumerable <SearchViewModel> Get(string query) { //http://so.iqiyi.com/so/q_你的名字 string queryStr = $"http://so.iqiyi.com/so/q_{query}"; return(QuerySearch.Crawler(queryStr)); }
public static List <BookReviewVM> GetBookReviewVMs(string baseUrl, QuerySearch query = null) { var returnBookReviews = QueryHelper.QueryList <BookReview>(query, "bookReview"); var bookReviewVMs = new List <BookReviewVM>(); foreach (var br in returnBookReviews) { var vm = new BookReviewVM() { Id = br.Id, ReviewerName = br.ReviewerName, ReviewText = br.ReviewText, PublishDate = br.PublishDate, BookId = br.BookId, Rating = br.Rating, }; vm.SetDefaultLinks(baseUrl, "bookreview", br.ReviewerName); vm.Embed = new Embed(books: BookCollection.GetBookEmbed(baseUrl, new List <int>() { br.BookId })); bookReviewVMs.Add(vm); } return(bookReviewVMs); }
protected override IQueryable <Song> Search(IQueryable <Song> items, QuerySearch search) { if (!string.IsNullOrEmpty(search?.Value)) { return(items.Where(x => x.Name.ToLower().Contains(search.Value.ToLower())).OrderBy(song => song.Name)); } return(items); }
protected override IQueryable <Post> Search(IQueryable <Post> items, QuerySearch search) { if (!string.IsNullOrEmpty(search?.Value)) { return(items.Where(x => x.Title.Contains(search.Value))); } return(items); }
protected void Page_Load(object sender, EventArgs e) { QuerySearch.Focus(); if (!IsPostBack) { pafap_global.Init.InitFiles = new pafap_files(); pafap_global.Init.InitFiles.bindDDLFromXMLFile(Server.MapPath("controls/paths.xml"), ddlpaths, "channel", "Name", "Name", "path"); } }
protected override IQueryable <Post> SourceOrder(IQueryable <Post> items, QuerySearch source) { if (Guid.TryParse(source.Value, out Guid sourceId)) { var posts = items.Where(x => x.ChannelId == sourceId); return(posts); } return(items); }
protected override IQueryable <Post> Category(IQueryable <Post> items, QuerySearch category) { if (!string.IsNullOrEmpty(category?.Value)) { if (category.Value != "Все категории") { var posts = items.Where(x => x.CategoryName.Contains(category.Value)); return(posts); } } return(items); }
public static List <CategoryVM> GetCategoryVMs(string baseUrl, QuerySearch query = null) { var returnCats = QueryHelper.QueryList <Category>(query, "category"); var categoryVMs = new List <CategoryVM>(); foreach (var cat in returnCats) { var vm = new CategoryVM() { Name = cat.Name, Id = cat.Id, }; vm.SetDefaultLinks(baseUrl, "category", cat.Name); vm.Embed = new Embed(authors: AuthorCollection.GetAuthorEmbed(baseUrl, cat.AuthorIds), books: BookCollection.GetBookEmbed(baseUrl, cat.BookIds)); categoryVMs.Add(vm); } return(categoryVMs); }
public static List <AuthorVM> GetAuthorVMs(string baseUrl, QuerySearch query = null) { var returnAuthors = QueryHelper.QueryList <Author>(query, "author"); var authorVMs = new List <AuthorVM>(); foreach (var aut in returnAuthors) { var vm = new AuthorVM() { FirstName = aut.FirstName, LastName = aut.LastName, Id = aut.Id, HeadshotImageUrl = aut.HeadshotImageUrl }; vm.SetDefaultLinks(baseUrl, "author", $"{aut.FirstName} {aut.LastName}"); vm.Embed = new Embed(books: BookCollection.GetBookEmbed(baseUrl, aut.BookIds), categories: CategoryCollection.GetCategoryEmbed(baseUrl, aut.CategoryIds)); authorVMs.Add(vm); } return(authorVMs); }
public static List <BookVM> GetBookVMs(string baseUrl, QuerySearch query = null) { var returnBooks = QueryHelper.QueryList <Book>(query, "book"); var bookVMs = new List <BookVM>(); foreach (var book in returnBooks) { var vm = new BookVM(book.Id, baseUrl) { Title = book.Title, Description = book.Description, CoverImageUrl = book.CoverImageUrl, PublishDate = book.PublishDate, }; vm.SetDefaultLinks(baseUrl, "book", book.Title); vm.Embed = new Embed(BookReviewCollection.GetBookReviewEmbed(baseUrl, book.BookReviewIds), AuthorCollection.GetAuthorEmbed(baseUrl, book.AuthorIds), CategoryCollection.GetCategoryEmbed(baseUrl, book.CategoryIds)); bookVMs.Add(vm); } return(bookVMs); }
protected override IQueryable <Category> Category(IQueryable <Category> items, QuerySearch category) { return(items); }
protected override IQueryable <Channel> SourceOrder(IQueryable <Channel> items, QuerySearch source) { return(items); }
protected abstract IQueryable <TEntity> SourceOrder(IQueryable <TEntity> items, QuerySearch source);
protected abstract IQueryable <TEntity> Category(IQueryable <TEntity> items, QuerySearch category);
protected abstract IQueryable <TEntity> Search(IQueryable <TEntity> items, QuerySearch search);
protected override IQueryable <Band> Search(IQueryable <Band> items, QuerySearch search) { throw new NotImplementedException(); }
public ActionResult <IEnumerable <CategoryVM> > Get([FromQuery] QuerySearch query) { return(CategoryCollection.GetCategoryVMs(_accessor.HttpContext.Request.Host.Value, query)?.ToList()); }
protected override IQueryable <Category> SourceOrder(IQueryable <Category> items, QuerySearch source) { return(items); }
protected override IQueryable <Channel> Search(IQueryable <Channel> items, QuerySearch search) { return(items); }
public ActionResult <IEnumerable <BookReviewVM> > Get([FromQuery] QuerySearch query) { return(BookReviewCollection.GetBookReviewVMs(_accessor.HttpContext.Request.Host.Value, query)?.ToList()); }
public void SaveQuery(QuerySearch query) { _dbContext.Add(query); _dbContext.SaveChangesAsync(); }
protected override IQueryable <Category> Search(IQueryable <Category> items, QuerySearch search) { return(items); }
protected override IQueryable <Contract> Search(IQueryable <Contract> items, QuerySearch search) { return(items); }