diff --git a/samples/features/json/product-catalog/dotnet-jquery-bootstrap-app/wwwroot/media/js/products.js b/samples/features/json/product-catalog/dotnet-jquery-bootstrap-app/wwwroot/media/js/products.js index 53469c11..c200fbd7 100644 --- a/samples/features/json/product-catalog/dotnet-jquery-bootstrap-app/wwwroot/media/js/products.js +++ b/samples/features/json/product-catalog/dotnet-jquery-bootstrap-app/wwwroot/media/js/products.js @@ -1,10 +1,13 @@ ROOT_API_URL = "/api/Product/"; +// ProductController is an object that contains actions the will be executed on +// get, save (create or update), delete var ProductController = function ($table, $modal) { return { - editProduct: function (productID) { + + getProduct: function (productID) { $.ajax(ROOT_API_URL + productID) .done( function (json) { $modal.loadJSON(json); @@ -14,6 +17,7 @@ var ProductController = }); }, + saveProduct: function (productID, product) { $.ajax({ contentType: 'application/json', @@ -73,7 +77,7 @@ $(document).ready(function () { ] });// end DataTable setup - // modal setup + // Bootstrap modal setup $modal = $('#myModal'); $modal.on('hide.bs.modal', function () { @@ -86,12 +90,11 @@ $(document).ready(function () { }); // end modal setup - var $form = $("#ProductForm"); var ctrl = ProductController($table, $modal); $table.on("click", "button.edit", function () { - ctrl.editProduct(this.attributes["data-id"].value); + ctrl.getProduct(this.attributes["data-id"].value); }); $table.on("click", "button.delete", @@ -102,8 +105,9 @@ $(document).ready(function () { $('body').on("click", "#submitButton", function (e) { e.preventDefault(); - var productId = $("#ProductForm #ProductID").val(); - var product = JSON.stringify($("#ProductForm").serializeJSON({ checkboxUncheckedValue: "false", parseAll: true })); + var $form = $("#ProductForm"); + var productId = $("#ProductID", $form).val(); + var product = JSON.stringify($form.serializeJSON({ checkboxUncheckedValue: "false", parseAll: true })); ctrl.saveProduct(productId, product); }); }); \ No newline at end of file diff --git a/samples/features/json/todo-app/dotnet-rest-api/Startup.cs b/samples/features/json/todo-app/dotnet-rest-api/Startup.cs index ec333350..9be6c720 100644 --- a/samples/features/json/todo-app/dotnet-rest-api/Startup.cs +++ b/samples/features/json/todo-app/dotnet-rest-api/Startup.cs @@ -26,8 +26,8 @@ namespace TodoApp // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - const string ConnString = "Server=SERVERNAME.database.windows.net;Database=DATABASENAME;User Id=USERNAME;Password=PASSWORD"; - + //const string ConnString = "Server=SERVERNAME.database.windows.net;Database=DATABASENAME;User Id=USERNAME;Password=PASSWORD"; + const string ConnString = "Server=.;Database=Todo;Integrated Security=true"; services.AddTransient( _=> new QueryPipe(new SqlConnection(ConnString))); services.AddTransient( _=> new Command(new SqlConnection(ConnString))); diff --git a/samples/features/json/todo-app/dotnet-rest-api/project.json b/samples/features/json/todo-app/dotnet-rest-api/project.json index 2ccbf1ff..2b71ec18 100644 --- a/samples/features/json/todo-app/dotnet-rest-api/project.json +++ b/samples/features/json/todo-app/dotnet-rest-api/project.json @@ -1,6 +1,6 @@ { "dependencies": { - "Belgrade.Sql.Client": "0.1.0", + "Belgrade.Sql.Client": "0.3.0", "Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final", "Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final", diff --git a/samples/features/json/todo-app/dotnet-rest-api/project.lock.json b/samples/features/json/todo-app/dotnet-rest-api/project.lock.json index c048b4f7..cbc0fff6 100644 --- a/samples/features/json/todo-app/dotnet-rest-api/project.lock.json +++ b/samples/features/json/todo-app/dotnet-rest-api/project.lock.json @@ -3,7 +3,7 @@ "version": 2, "targets": { ".NETFramework,Version=v4.6": { - "Belgrade.Sql.Client/0.1.0": { + "Belgrade.Sql.Client/0.3.0": { "type": "package", "dependencies": { "System.Data.SqlClient": "(, )" @@ -13,10 +13,10 @@ "System.Data" ], "compile": { - "lib/Belgrade.SqlClient.dll": {} + "lib/net45/CLR-Belgrade-SqlClient.dll": {} }, "runtime": { - "lib/Belgrade.SqlClient.dll": {} + "lib/net45/CLR-Belgrade-SqlClient.dll": {} } }, "Libuv/1.9.0-rc2-20901": { @@ -1771,13 +1771,16 @@ } }, "libraries": { - "Belgrade.Sql.Client/0.1.0": { - "sha512": "g+OdZ5XStR1Tf5nhdfzNPEY9xLyAwwsM+t7rXhi/WyGD3Nb4G8sufhjMwoAwpIzjqhNuUlGxZL0nlWCZNMRtow==", + "Belgrade.Sql.Client/0.3.0": { + "sha512": "xHdhJxQEjbjEijhyw8g3rnrx1K2ddRoK+ZB8L0IM8JM6cu0kdLwJN7SADmf6SYxaAAgeXeA0FQE29K/a3CUD/g==", "type": "package", + "path": "Belgrade.Sql.Client/0.3.0", "files": [ - "Belgrade.Sql.Client.0.1.0.nupkg.sha512", + "Belgrade.Sql.Client.0.3.0.nupkg.sha512", "Belgrade.Sql.Client.nuspec", - "lib/Belgrade.SqlClient.dll" + "lib/net45/CLR-Belgrade-SqlClient.dll", + "lib/netcoreapp1.0/CLR-Belgrade-SqlClient.dll", + "lib/netstandard1.5/CLR-Belgrade-SqlClient.dll" ] }, "Libuv/1.9.0-rc2-20901": { @@ -5394,7 +5397,7 @@ }, "projectFileDependencyGroups": { "": [ - "Belgrade.Sql.Client >= 0.1.0", + "Belgrade.Sql.Client >= 0.3.0", "Microsoft.AspNetCore.Mvc >= 1.0.0-rc2-final", "Microsoft.AspNetCore.Server.IISIntegration >= 1.0.0-rc2-final", "Microsoft.AspNetCore.Server.Kestrel >= 1.0.0-rc2-final",