Right click on ‘Controllers’ folder –> Add –> New Scaffolded Item…
For api controller without views select ‘API Controller with actions, using Entity Framework’ and click ‘Add’.
If MVC then choose ‘MVC Controller with views, using using Entity Framework’
On next view select your model (you need create model before generate code) and select data context (if you don’t have already existing one then you can create clicking ‘+’ sign)
Click ‘Add’ and it should start generate code (controller with CRUD to your model).
In older project you can get error trying to generate code, could be problem with e.g. unupdated packages: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Design’.