ASP.NET Core Product Inventory application that uses SQL/JSON functionalities
This project contains an example implementation of ASP.NET Core application that shows how to implement simple product catalog that enables you to browse edit and delete list products in catalog.
Contents
About this sample
Before you begin
Run this sample
Sample details
Disclaimers
Related links
About this sample
- Applies to: SQL Server 2016 (or higher), Azure SQL Database
- Key features: JSON functions in SQL Server 2016/Azure SQL Database
- Programming Language: C#, Html/JavaScript, Transact-SQL
- Authors: Jovan Popovic
Before you begin
To run this sample, you need the following prerequisites.
Software prerequisites:
- SQL Server 2016 (or higher) or an Azure SQL Database
- Visual Studio 2015 (or higher) with the ASP.NET Core RC2 (or higher)
Azure prerequisites:
- Permission to create an Azure SQL Database
Run this sample
-
From SQL Server Management Studio or Sql Server Data Tools connect to your SQL Server 2016 or Azure SQL database and execute setup.sql script that will create and populate Product table and create required stored procedures.
-
From Visual Studio 2015 Update 3, open the ProductCatalog.xproj file from the root directory,
-
Locate Startup.cs file in the project, change connection string in ConfigureServices method to reference your database, and build solution using Ctrl+Shift+B, right-click on project + Build, or Build/Build Solution from menu.
-
Run sample app using F5 or Ctrl+F5, 4.1. Open /index.html Url to get all products from database, 4.2. Use expand buttons to see history of products, 4.3. Restore some of the previous version using restore link, 4.4. Use Slider to go back in time.
Sample details
This sample application shows how to display list of products, edite or delete some product. Front-end code is implemented using JQuery/JQuery UI libraries, and JQuery DataTable component for displaying data. Server-side code is implemented using ASP.NET Core Web API. SQL Server JSON functions are used to format product data that will be sent to front-end page.
Disclaimers
The code included in this sample is not intended demonstrate some general guidance and architectural patterns for web development. It contains minimal code required to create REST API, and it does not use some patterns such as Repository. Sample uses built-in ASP.NET Core Dependency Injection mechanism; however, this is not prerequisite. You can easily modify this code to fit the architecture of your application.
Related Links
You can find more information about the components that are used in this sample on these locations: JQuery DataTables.
Code of Conduct
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
License
These samples and templates are all licensed under the MIT license. See the license.txt file in the root.
Questions
Email questions to: [sqlserversamples@microsoft.com](mailto: sqlserversamples@microsoft.com).