Welcome to the ASP.NET Core Web API repository by ConceptZee Solutions. This project demonstrates how to build a robust and efficient Web API using ASP.NET Core.
This project showcases an ASP.NET Core Web API designed to handle various HTTP requests and perform CRUD operations. It is a simple yet comprehensive example to get you started with building APIs in ASP.NET Core.
- CRUD Operations: Perform Create, Read, Update, Delete operations on entities.
- Entity Framework Core: Database management using EF Core.
- Dependency Injection: Implement DI for better code maintainability.
- Automated Testing: Basic unit tests for API endpoints.
- Error Handling: Robust error handling and validation.
- ASP.NET Core: The framework used for building the Web API.
- Entity Framework Core: For database interactions.
- Swagger: For API documentation and testing.
- xUnit: For unit testing.
- .NET 6 SDK
- SQL Server or any other supported database
- Visual Studio 2022
-
Clone the repository:
git clone https://github.com/SaleemCB/ASP_DotNetCore_WebAPI.git cd ASP_DotNetCore_WebAPI
-
Restore packages:
dotnet restore
-
Update Database: At present this uses an SQLite Db Update your database connection string in
appsettings.json
and run the following command to apply migrations:dotnet ef database update
-
Run the application:
dotnet run
- Launch the project in Visual Studio 2022.
- Build the solution and run the project.
- Use Swagger UI to test the API endpoints at
http://localhost:5000/swagger
.
The API documentation is available via Swagger at http://localhost:5000/swagger
. Use this interface to interact with the API endpoints and test their functionality.
Here is a list of the main API endpoints:
- ** GET /api/czeecontacts/GetContacts: Retrieve a list of contacts.
- ** GET /api/czeecontacts/GetContacts/{id}**: Retrieve a specific contact by ID.
- ** POST /api/czeecontacts/PostContact: Create a new contact.
- ** PUT -- not yet implemented.
- ** DELETE /api/export/ClearContacts: Deletes all contacts.
Contributions are welcome! Please submit a pull request or open an issue to discuss changes.
This project is licensed under the MIT License. See the LICENSE file for details.