Skip to content

prags9/InventoryWebService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InventoryWebService

Created a ASP.NET Core MVC app with the basic CRUD and sort funtionality. Apis have been exposed under the routes and port[8081] shared as in question sheet.

Tools and version Used-

  1. .Net 6
  2. SQL Server Express 2019 (This has been commented out for testing purpose)
  3. InMemory EFCore - version 6 (This will be working, it has been added so we don't require DB setup to test APIS/MVC app)
  4. Visual Studio 2022
  5. Postman

Routes-

  1. Get All - GET - https://localhost:{{port}}/api/Inventory

  2. GetByItem - GET - https://localhost:{{port}}/api/Inventory/{itemName}

  3. CreateOrUpdate - POST - https://localhost:{{port}}/api/Inventory

  4. Update - PUT - https://localhost:{{port}}/api/Inventory/{itemName}

  5. Delete - DELETE - https://localhost:{{port}}/api/Inventory/{itemName}

  6. Sort - GET - https://localhost:{{port}}/api/Inventory/values?sortBy=quantity_desc&returnVal=all

    The sortBy and returnVal query strings can have multiple values -

    sortBy-

    • sortBy = quantity_desc - Order by quantity desc
    • sortBy = quantity - Order by quantity asc
    • sortBy = Date - Order by created on desc
    • sortBy = date_desc - Order by created on desc
    • sortBy = name_desc - Order by name desc
    • sortBy = name - Order by name asc

    returnVal-

    • returnVal = 1 - Return Top 1 based on the sortBy specified (Highest/Lowest)
    • returnVal = all -Returns all items in the specicifed order

EditApi

This is the Index page of MVC app.

InventoryIndex

This is an example of Sort APi-

Sort

Extra Features-

  1. Concurrency conflicts - I have handled concurrency conflict using RowVersion. If we have opened the same item in two tabs and one user is updating the quantity in one tab, and the other user tries to update in the second tab, it will throw a ModelState Error- stating that value has been modified by the user and it shows the current value under the quantity field.

ConcurrencyConflict Also throught API Request, we can see the following error- ConcurrencyConflictAPI

  1. Included LastUpdatedOn field so that we can track the update history.
  2. Included Unit test (xUnit) for controllers

Note:- RowVersion functionality will only work when connected to sql server express.

About

ASP.Net core MVC 6 application for Inventory Management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published