Hello :). I'm new with episerver and i have a task to implement block which have to get information from the database and visualize it (also paginate, and search with an input field). Any suggestions please :) ?
Hi, welcome to the platform.
You don't directly access the Optimizely CMS (formally Episerver) database, as standard you wouls retrive the content either one of 2 ways.
The different with 1 and 2 depends on what you're wanting to retrive. Commonly the search provider should be used for large search queries or queries with search parameters. This would include search pages, listings, related content and anything with groups of content. 1 and using the APIs is usage a lot when you are loading content within an instance of a block or page, or loading from references. Although the controllers page instances of the block/page as standard in the controllers.
In your scenario if you're trying to search, paginate and take an input field I would use the search provider you're using in your solution. This would be the following process
All of this will be handled as per standard MVC.
If you're new to the platform I'd suggest installing the Alloy demo and getting familiar with how it works. https://world.optimizely.com/documentation/developer-guides/CMS/getting-started/install-a-sample-site/ there are examples of using search. You can install the lucence search or Search and Navigation (Find) and you can create a demo index for it here https://find.episerver.com/