From 3a4fd9f2f2a6d3b9fe29ac2c30519eff8f41fb97 Mon Sep 17 00:00:00 2001 From: James Kolpack Date: Mon, 19 Sep 2016 12:01:08 -0400 Subject: [PATCH] Ready to deploy --- InventoryTraker.Web/App_Start/EFConfig.cs | 2 +- InventoryTraker.Web/App_Start/SeedData.cs | 4 ++-- InventoryTraker.Web/Controllers/InventoryController.cs | 3 +++ InventoryTraker.Web/NLog.config | 4 ++-- .../js/inventory/templates/inventoryEdit.tmpl.cshtml | 5 ++++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/InventoryTraker.Web/App_Start/EFConfig.cs b/InventoryTraker.Web/App_Start/EFConfig.cs index cf5dae9..9baab06 100644 --- a/InventoryTraker.Web/App_Start/EFConfig.cs +++ b/InventoryTraker.Web/App_Start/EFConfig.cs @@ -7,7 +7,7 @@ namespace InventoryTraker.Web { public static void Initialize() { - Database.SetInitializer(new DropCreateDatabaseAlways()); + Database.SetInitializer(new CreateDatabaseIfNotExists()); } } } \ No newline at end of file diff --git a/InventoryTraker.Web/App_Start/SeedData.cs b/InventoryTraker.Web/App_Start/SeedData.cs index 8dda30b..ab2ed50 100644 --- a/InventoryTraker.Web/App_Start/SeedData.cs +++ b/InventoryTraker.Web/App_Start/SeedData.cs @@ -52,9 +52,9 @@ namespace InventoryTraker.Web context.SaveChanges(); - AddInventory(context); + //AddInventory(context); - context.SaveChanges(); + //context.SaveChanges(); } } } diff --git a/InventoryTraker.Web/Controllers/InventoryController.cs b/InventoryTraker.Web/Controllers/InventoryController.cs index 91692e6..9ec8c75 100644 --- a/InventoryTraker.Web/Controllers/InventoryController.cs +++ b/InventoryTraker.Web/Controllers/InventoryController.cs @@ -87,6 +87,9 @@ namespace InventoryTraker.Web.Controllers if (!ModelState.IsValid) return GetModelStateErrorListJson(); + if (form.InventoryQuantities == null || !form.InventoryQuantities.Any()) + return GetErrorListJson("Must add at least one item"); + var errors = new List(); foreach (var quantityForm in form.InventoryQuantities) diff --git a/InventoryTraker.Web/NLog.config b/InventoryTraker.Web/NLog.config index 2c7f8f7..7fd01fd 100644 --- a/InventoryTraker.Web/NLog.config +++ b/InventoryTraker.Web/NLog.config @@ -16,8 +16,8 @@ for information on customizing logging rules and outputs. --> - - + + diff --git a/InventoryTraker.Web/js/inventory/templates/inventoryEdit.tmpl.cshtml b/InventoryTraker.Web/js/inventory/templates/inventoryEdit.tmpl.cshtml index 062ce13..15f707a 100644 --- a/InventoryTraker.Web/js/inventory/templates/inventoryEdit.tmpl.cshtml +++ b/InventoryTraker.Web/js/inventory/templates/inventoryEdit.tmpl.cshtml @@ -37,7 +37,10 @@ - {{transaction.transactionType}} + + {{transaction.transactionType}} + + {{transaction.memo}} {{transaction.transactionDate | date:'shortDate'}} {{transaction.addedQuantity}}