INSERT : Controller
BasicCRUD Insert Query with Bridge
Last updated
BasicCRUD Insert Query with Bridge
Last updated
Now let us look at the control and action, for our add customer.
We have the controller created. So in the Constructor, we inject all the dependencies that we need in our controller, we can have our own independence and for the add customer since it was create it created the post method and the route is by default at customer.
Then we do the basic validations, Create a AddCustomerParams as we explained earlier, then in the ContextInfo, the AccessorInfo is mapped. Then it is passed to be filled with the params value and passed in onto the services and any result that comes from the services is written back to the user of the API. If it is successful, then finally it will return the 201 status code with the result, here one interesting thing is what with the result.