This project parses data from a CSV file into the database. If the data in the CSV already exists in the Database, it will be updated accordingly.
To ensure smooth usage without errors, please make sure to send a valid CSV file. The CSV file should adhere to the following format:
username -> string
useridentifier -> Guid
age -> int
city -> string
phonenumber -> string
email -> string
Note:
username: A string representing the user's name.useridentifier: A unique identifier in the form of a GUID (Globally Unique Identifier).age: An integer representing the user's age.city: A string indicating the user's city.phonenumber: A string containing the user's phone number.email: A string representing the user's email address.
Please ensure that your CSV file follows this specified format for proper processing.
To use this project, follow these steps:
-
Download the project to your computer.
-
Ensure you have the .NET 7 SDK installed on your machine.
-
Check the database settings in appsettings.json. Ensure that you have already created a database manually with the name
CSVParserDb. -
Open the terminal in the project folder.
-
Run the command
dotnet runin the terminal. -
If the project starts successfully, you will see it running on your browser via Swagger.
Swagger provides two functions:
-
Get: Use this endpoint to check if Swagger is working correctly.
-
Create: This endpoint allows you to upload a CSV file. If the data in the CSV file is valid, it will be saved to the database.
In our GitHub repository, you can find an example CSV file at the following path: example.csv. You can use this file as a reference to understand the required format for the CSV data.