Customer CRUD operation Rest API developed using Asp.Net Core and Entity Framework Core
#To run the project
1.Open command prompt, run command cd "project path"
-
Run command "dotnet run"
-
In command prompt, it will display the port on which the API is running.
-
Open a browser and navigate to http://localhost:5000/swagger/index.html (here port no. is 5000)
-
It will open the Swagger UI, where the API methods can be called and tested.
Fundamentals used in this project:
- SOLID principles
- Mapping using Automapper
- API documentation using Swagger/OpenAPI
- Data model validations using data annotations and custom validators
- Support for XML content type along with JSON.
Fundamentals to be implemented (In progress)
- Push notifications
- Docker Container
TEST DATA FOR TESTING:
- GetCustomers
Method: GET
Url: http://localhost:5000/api/customers/
Headers: Accept: application/json Content-Type: application/json
- GetCustomer
Method: GET
Url: http://localhost:5000/api/customers/e2c46906-2ea4-4672-a81f-bd69890c9b16
Headers: Accept: application/json Content-Type: application/json
- CreateCustomer
Method: POST
Url: http://localhost:5000/api/customers/
Headers: Accept: application/json Content-Type: application/json
{ "personalNumber": "199502182365", "email": "[email protected]", "address": { "zipCode": 55604, "country": "Finland" }, "phoneNumber": "+3585003556721" }
- Update [HttpPut]
Method: PUT
Url: http://localhost:5000/api/customers/e2c46906-2ea4-4672-a81f-bd69890c9b16
Headers: Accept: application/json Content-Type: application/json
{ "personalNumber": "199502182365", "email": "[email protected]", "address": { "zipCode": 55604, "country": "Finland" }, "phoneNumber": "+3585003556721" }
- Update [HttpPatch]
Method: PATCH
Url: http://localhost:5000/api/customers/e2c46906-2ea4-4672-a81f-bd69890c9b16
Headers: Content-Type:application/json-patch+json Accept:application/json
[ { "op":"replace", "path":"/phoneNumber", "value":"+467452020" } ]
[ { "op":"replace", "path":"/address/zipCode", "value":15130 } ]
[ { "op":"replace", "path":"/address/zipCode", "value":15134 }, { "op":"replace", "path":"/email", "value":"[email protected]" } ]
[ { "op":"copy", "from":"/address/zipCode", "path":"/address/zipCode" } ]
- Delete Customer [HttpDelete]
Method: DELETE
Url: http://localhost:5000/api/customers/e2c46906-2ea4-4672-a81f-bd69890c9b16
Headers: Content-Type:application/json Accept:application/json