GithubHelp home page GithubHelp logo

husseinyoussef / billing-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 21 KB

Billing System using .net core and sqlite

C# 100.00%
dotnet-core entity-framework-core csharp xunit unit-testing sqlite

billing-api's Introduction

Billing System

This is a Billing system that manages items and shopping carts by allowing viewing and manipulating items, and generating bills.

Functionalities

  • View different items.
  • Create and Update items.
  • Delete items.
  • Generate a bill for a shopping cart.

Stack

  • .Net Core
  • Entity Framework Core
  • Sqlite
  • Xunit

Run the Server

From BillingApi directory run:

dotnet run

Endpoints

GET: /api/items

  • General: Return all available items.

  • Sample: curl -X GET http://localhost:5000/api/items

  • Response:

    [
        {
            "name": "T-Shirt",
            "price": 200,
            "discount": 10
        },
        {
            "name": "Pants",
            "price": 150,
            "discount": 5
        },
        {
            "name": "Hat",
            "price": 50,
            "discount": 0
        },
        {
            "name": "Shoes",
            "price": 100,
            "discount": 10
        },
        {
            "name": "Suit",
            "price": 1000,
            "discount": 15
        },
        {
            "name": "Jacket",
            "price": 300,
            "discount": 10
        },
        {
            "name": "Dress",
            "price": 500,
            "discount": 15
        },
        {
            "name": "SunGlasses",
            "price": 70,
            "discount": 10
        },
        {
            "name": "Jeans",
            "price": 250,
            "discount": 15
        }
    ]
    

GET: /api/items/{id}

  • General: Return an item with the specified id.

  • Sample: curl -X GET http://localhost:5000/api/items/1

  • Response:

    {
        "name": "T-Shirt",
        "price": 200,
        "discount": 10
    }
    

POST: /api/items

  • General:

    • Create a new item.
    • Returns the newly created item when successful.
  • Sample:

    • curl -X POST http://localhost:5000/api/items
    • Body: { "name": "Dress", "price": 500, "discount": 10 }
  • Response:

    {
        "name": "Dress",
        "price": 500,
        "discount": 10
    }
    

PUT: /api/items/{id}

  • General:

    • Update an item.
    • Return no content for successful update.
  • Sample:

    • curl -X PUT http://localhost:5000/api/items/1
    • Body: { "name": "Dress", "price": 300, "discount": 15 }

DELETE: /api/items/{id}

  • General:

    • Delete the item with the specified id.
    • Returns no content for successful delete.
  • Sample: curl -X DELETE http://localhost:5000/api/items/1

POST: /api/carts

  • General:

    • Create a new shopping cart.
    • Return a bill for that cart.
  • Sample:

    • curl http://localhost:5000/api/carts
    • Body: { "Currency": "CAD", "cartItems": [ { "name": "T-Shirt", "quantity": 2 }, { "name": "Shoes", "quantity": 1 }, { "name": "Suit", "quantity": 1 } ] }
  • Response:

    {
        "billItems": [
            {
                "name": "T-Shirt",
                "price": 200,
                "discount": 10,
                "afterDiscountPrice": 180,
                "quantity": 2,
                "totalPrice": 360
            },
            {
                "name": "Shoes",
                "price": 100,
                "discount": 10,
                "afterDiscountPrice": 90,
                "quantity": 1,
                "totalPrice": 90
            },
            {
                "name": "Suit",
                "price": 1000,
                "discount": 15,
                "afterDiscountPrice": 850,
                "quantity": 1,
                "totalPrice": 850
            }
        ],
        "subTotal": 1300,
        "VAT": 14,
        "currency": "CAD",
        "total": 1482
    }
    

billing-api's People

Contributors

husseinyoussef avatar

Watchers

 avatar  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.