All CRUD Operation Controllers must have same httpverbs and names for consistancy
[HttpGet]Index : For Get All Records with In-Active List
[HttpGet] Details: For Get Detail Records by Primary Key
[HttpPost] Create: For Creating New Records in Database
[HttpPatch] Update: For Updating Old Record in Database
[HttpDelete] Delete: For Deleting Old Record from Database
Separate Request and Response Model for each create, update, getall, details endpoint
Request Models Should start with prefix Req
Response Models should Start from prefix Res
Request Modules should have matching fluent validators defined
Controllers should inject respective related serivce/repo from dependency injection
Update Method of controller should first get old data from db, make change to only required fields, and then update to database
Call Sequence should be like:
Controller => Service [optional] => Repo => Database
Should use Authorize Attribute in combination with Roles, and Permission Check
Should Decode JWT Token in middleware and populate request scope context along with user information so that same user credentials can be accessed and used in all controllers, services, repo which are related to consecutive request
Things Related to Repo
One Database Table/View/SP should have only 1 respective Repo
Repo should have related interface and prefix repo name with I eg. IUserRepo for UserRepo
Interface should inherit from IGeneralRepositories
Repo should inherit from _AbsGeneralRepositories
Repo should implement related interface
Dependency Injection should be defined for Interface and Repo
Inheriting IGeneralReop will make available of basic functions automatically
GetList
GetDetails
Insert
Update
Override FilterActive function to separate things with active and inactive
Override FilterDelete function to hide soft deleted records
Override AddDefaultInserts function to add default values for db insert object
Override AddDefaultUpdates function to add default vaules for db update object