An ASP.NET Core API for managing customer records, featuring AutoMapper for seamless DTO to model mappings.
This project is an ASP.NET Core API designed for managing customer records. It includes features for adding, updating, deleting, and retrieving customer details. The implementation leverages AutoMapper for efficient and maintainable DTO to model mappings, ensuring a clean separation of concerns and easy data transformations.
- Add new customers
- Retrieve all customers
- Get customer details by ID
- Update customer details
- Soft delete customers
- Hard delete customers
- AutoMapper integration for DTO and model mappings
- Structured logging with Serilog and Seq
-
Clone the repository:
git clone https://github.com/your-username/CustomerManagementAPI-WithAutoMapper.git
-
Navigate to the project directory:
cd CustomerManagementAPI-WithAutoMapper -
Restore dependencies:
dotnet restore
-
Build the project:
dotnet build
-
Run the project:
dotnet run
- Open your preferred API testing tool (e.g., Postman, cURL).
- Use the following base URL for your API requests:
https://localhost:5001/api/v1/Customers
- URL:
POST /api/v1/Customers/AddCustomer - Request Body:
{ "name": "John Doe", "email": "john.doe@example.com", "password": "password123" } - Response:
200 OKif successful409 Conflictif email already exists
- URL:
GET /api/v1/Customers/GetAllCustomers - Response:
200 OKwith a list of customers
- URL:
GET /api/v1/Customers/GetCustomerDetail/{customerId} - Response:
200 OKwith customer details404 Not Foundif customer does not exist
- URL:
PUT /api/v1/Customers/Update-Customer/{customerId} - Request Body:
{ "name": "Jane Doe", "email": "jane.doe@example.com", "password": "newpassword123" } - Response:
200 OKif successful404 Not Foundif customer does not exist
- URL:
DELETE /api/v1/Customers/Soft-Delete/{customerId} - Response:
204 No Contentif successful404 Not Foundif customer does not exist
- URL:
DELETE /api/v1/Customers/HardDelete/{customerId} - Response:
204 No Contentif successful404 Not Foundif customer does not exist
Contributions are welcome! Please open an issue or submit a pull request for any improvements or additions.
Make sure to replace your-username with your actual GitHub username in the repository URL. This README provides a comprehensive overview of the project, its features, installation instructions, usage examples, and API endpoints.