Skip to content

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.

Notifications You must be signed in to change notification settings

RahulMule/DotNetWebAPI-InMemory-Database

Repository files navigation

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/RahulMule/DotNetWebAPI_InMemoryDatabase.git
  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.

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy