What you are looking for is to be done on the runtime, and these attributed at mapped at compile-time. You will not be able to modify them after your app has been built.
One way to solve this would be to use a dynamic route and then process the actual URI on runtime and execute the controller/action based on that.
Dynamic controller routing in ASP.NET Core 3.0 | StrathWeb. A free flowing web tech monologue.[
^]
Most of the dynamic path mapping techniques would also fail since your data comes from a database. So unless your database is used to generate the code and routes in the application, these techniques would fail. You would need to use a wildcard to catch all the requests and then pass the request to the appropriate controller and action. Yep, things like
RedirectToAction()
would come in use here. This thread on SO talks about this approach,
c# - Dynamic Routes from database for ASP.NET MVC CMS - Stack Overflow[
^]
Handle requests with controllers in ASP.NET Core MVC | Microsoft Docs[
^]