Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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);
 }
Esempio n. 5
0
 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");
     }
 }
Esempio n. 6
0
        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);
        }
Esempio n. 7
0
 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);
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 protected override IQueryable <Category> Category(IQueryable <Category> items, QuerySearch category)
 {
     return(items);
 }
Esempio n. 12
0
 protected override IQueryable <Channel> SourceOrder(IQueryable <Channel> items, QuerySearch source)
 {
     return(items);
 }
Esempio n. 13
0
 protected abstract IQueryable <TEntity> SourceOrder(IQueryable <TEntity> items, QuerySearch source);
Esempio n. 14
0
 protected abstract IQueryable <TEntity> Category(IQueryable <TEntity> items, QuerySearch category);
Esempio n. 15
0
 protected abstract IQueryable <TEntity> Search(IQueryable <TEntity> items, QuerySearch search);
Esempio n. 16
0
 protected override IQueryable <Band> Search(IQueryable <Band> items, QuerySearch search)
 {
     throw new NotImplementedException();
 }
Esempio n. 17
0
 public ActionResult <IEnumerable <CategoryVM> > Get([FromQuery] QuerySearch query)
 {
     return(CategoryCollection.GetCategoryVMs(_accessor.HttpContext.Request.Host.Value, query)?.ToList());
 }
Esempio n. 18
0
 protected override IQueryable <Category> SourceOrder(IQueryable <Category> items, QuerySearch source)
 {
     return(items);
 }
Esempio n. 19
0
 protected override IQueryable <Channel> Search(IQueryable <Channel> items, QuerySearch search)
 {
     return(items);
 }
Esempio n. 20
0
 public ActionResult <IEnumerable <BookReviewVM> > Get([FromQuery] QuerySearch query)
 {
     return(BookReviewCollection.GetBookReviewVMs(_accessor.HttpContext.Request.Host.Value, query)?.ToList());
 }
Esempio n. 21
0
 public void SaveQuery(QuerySearch query)
 {
     _dbContext.Add(query);
     _dbContext.SaveChangesAsync();
 }
Esempio n. 22
0
 protected override IQueryable <Category> Search(IQueryable <Category> items, QuerySearch search)
 {
     return(items);
 }
Esempio n. 23
0
 protected override IQueryable <Contract> Search(IQueryable <Contract> items, QuerySearch search)
 {
     return(items);
 }