Skip to content

This project contains a sample ASP.NET Core app. This app is an example of the article I produced for the Telerik Blog (telerik.com/blogs).

License

Notifications You must be signed in to change notification settings

zangassis/pet-manager

Repository files navigation

PetManager 🐶🐱

This project contains a sample ASP.NET Core app. This app is an example of the article I produced for the Telerik Blog (telerik.com/blogs).

PetManager is a minimal API built using .NET 7 that allows you to manage pets using a SQLite database. It provides basic CRUD (Create, Read, Update, Delete) operations for pet entities.

Requirements

Before running the PetManager project, ensure that you have the following dependencies installed:

🥏 Getting Started

To download and run the PetManager project, follow these steps:

  1. Clone the repository to your local machine:

    git clone https://github.com/zangassis/pet-manager.git
  2. Navigate to the project directory:

    cd PetManager
  3. Build the project:

    dotnet build
  4. Apply the database migrations to create the SQLite database:

    dotnet ef database update --project PetManager
  5. Run the API:

    dotnet run --project PetManager

The API should now be running locally on http://localhost:[PORT].

🧩 API Endpoints

The PetManager API provides the following endpoints:

  • GET /pets: Retrieves all pets.
  • GET /pets/{id}: Retrieves a specific pet by its ID.
  • POST /pets: Creates a new pet.
  • PUT /pets/{id}: Updates an existing pet.
  • DELETE /pets/{id}: Deletes a pet.

🐶 Example Usage

To create a new pet, you can use a tool like cURL or a REST client of your choice:

curl -X POST -H "Content-Type: application/json" -d '{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "Max",
  "species": "Dog",
  "breed": "Golden Retriever",
  "age": 3,
  "color": "Golden",
  "weight": 30,
  "vaccinated": true,
  "lastVaccinationDate": "2023-05-01",
  "owner": {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "John Doe",
    "email": "johndoe@example.com",
    "phone": "123-456-7890"
  }
}
' http://localhost:5000/api/pets

This will create a new pet named "Max" with the species "Dog" and age 3.

🌟 Contributing

Contributions to the PetManager project are welcome! If you encounter any issues or have suggestions for improvement, please open an issue on the GitHub repository: https://github.com/zangassis/pet-manager/issues

When contributing code, please follow the existing code style and submit a pull request with your changes.

⚖ License

The PetManager project is licensed under the MIT License. You can find more information in the LICENSE file.

📞 Contact

If you have any questions or need further assistance, you can reach out to the project maintainers:

Feel free to contact us with any feedback or inquiries.

Thank you for using PetManager!

About

This project contains a sample ASP.NET Core app. This app is an example of the article I produced for the Telerik Blog (telerik.com/blogs).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages