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