Giter Site home page Giter Site logo

crud-dotnetcore-8's Introduction

DotNetWebAPI_InMemoryDatabase

This is a simple .NET Web API project for managing books, created to explore .NET 8 with Entity Framework Core using an in-memory database. The project follows the repository pattern to handle book-related operations.

Table of Contents

Introduction

The project is a RESTful Web API that provides endpoints to perform CRUD operations on books. It utilizes Entity Framework Core with an in-memory database for data storage.

Features

  • Get All Books: Retrieve a list of all books.
  • Add Book: Add a new book to the database.
  • Delete Book: Delete a book by its ID.
  • Update Book: Update an existing book.
  • Get Book by ID: Retrieve a specific book by its ID.

Prerequisites

Before you begin, ensure you have the following prerequisites:

  • .NET 8 SDK installed. Download here
  • An Integrated Development Environment (IDE) like Visual Studio or Visual Studio Code.
  • Git installed. Download here

Getting Started

  1. Clone the repository:

    git clone https://github.com/fernandoguide/CRUD-dotnetcore-8
  2. Open the project in your preferred IDE.

  3. Build the solution.

  4. Run the application.

Usage

The API provides the following endpoints:

  • GET /api/books: Retrieve a list of all books.

  • POST /api/books: Add a new book to the database.

    Example Request:

    {
        "title": "The Great Gatsby",
        "description": "A novel by F. Scott Fitzgerald",
        "author": "F. Scott Fitzgerald",
        "price": 10.99
    }

    Example Response:

    {
        "status": "OK"
    }
  • GET /api/books/{id}: Retrieve a specific book by its ID.

    Example Response:

    {
        "id": 1,
        "title": "The Great Gatsby",
        "description": "A novel by F. Scott Fitzgerald",
        "author": "F. Scott Fitzgerald",
        "price": 10.99
    }
  • DELETE /api/books/{id}: Delete a book by its ID.

  • PUT /api/books: Update an existing book.

    Example Request:

    {
        "id": 1,
        "title": "New Title",
        "description": "Updated description",
        "author": "Updated Author",
        "price": 19.99
    }

    Example Response:

    {
        "status": "OK"
    }

Feel free to explore and customize the code to suit your needs.

Contributing

Contributions are welcome! Fork the repository, make your changes, and submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

crud-dotnetcore-8's People

Contributors

fernandoguide avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.