diff --git a/eShopOnWeb/eShop.MVC/Models/Infrastructure/CatalogDBInitializer.cs b/eShopOnWeb/eShop.MVC/Models/Infrastructure/CatalogDBInitializer.cs index c3e6f17..4bfeb01 100644 --- a/eShopOnWeb/eShop.MVC/Models/Infrastructure/CatalogDBInitializer.cs +++ b/eShopOnWeb/eShop.MVC/Models/Infrastructure/CatalogDBInitializer.cs @@ -40,7 +40,7 @@ protected override void Seed(CatalogDBContext context) AddCatalogBrands(context); AddCatalogItems(context); AddCatalogItemPictures(); - + } private void AddCatalogTypes(CatalogDBContext context) @@ -174,7 +174,7 @@ IEnumerable GetCatalogItemsFromFile(CatalogDBContext context) string[] csvheaders; string[] requiredHeaders = { "catalogtypename", "catalogbrandname", "description", "name", "price", "pictureFileName" }; - string[] optionalheaders = { "availablestock", "restockthreshold", "maxstockthreshold", "onreorder" }; + string[] optionalheaders = { "availablestock", "maxstockthreshold", "onreorder" }; csvheaders = GetHeaders(csvFileCatalogItems, requiredHeaders, optionalheaders); var catalogTypeIdLookup = context.CatalogTypes.ToDictionary(ct => ct.Type, ct => ct.Id); @@ -239,23 +239,6 @@ static CatalogItem CreateCatalogItem(string[] column, string[] headers, Dictiona } } - int restockThresholdIndex = Array.IndexOf(headers, "restockthreshold"); - if (restockThresholdIndex != -1) - { - string restockThresholdString = column[restockThresholdIndex].Trim('"').Trim(); - if (!String.IsNullOrEmpty(restockThresholdString)) - { - if (int.TryParse(restockThresholdString, out int restockThreshold)) - { - catalogItem.RestockThreshold = restockThreshold; - } - else - { - throw new Exception($"restockThreshold={restockThreshold} is not a valid integer"); - } - } - } - int maxStockThresholdIndex = Array.IndexOf(headers, "maxstockthreshold"); if (maxStockThresholdIndex != -1) { @@ -299,7 +282,7 @@ static string[] GetHeaders(string csvfile, string[] requiredHeaders, string[] op if (csvheaders.Count() < requiredHeaders.Count()) { - throw new Exception($"requiredHeader count '{ requiredHeaders.Count()}' is bigger then csv header count '{csvheaders.Count()}' "); + throw new Exception($"requiredHeader count '{requiredHeaders.Count()}' is bigger then csv header count '{csvheaders.Count()}' "); } if (optionalHeaders != null) @@ -346,7 +329,7 @@ private void AddCatalogItemPictures() { file.Delete(); } - + string zipFileCatalogItemPictures = Path.Combine(environment.ContentRootPath, "Setup", "CatalogItems.zip"); ZipFile.ExtractToDirectory(zipFileCatalogItemPictures, picturePath.ToString()); } diff --git a/eShopOnWeb/eShop.MVC/Views/Catalog/Create.cshtml b/eShopOnWeb/eShop.MVC/Views/Catalog/Create.cshtml index acef5b7..d14c413 100644 --- a/eShopOnWeb/eShop.MVC/Views/Catalog/Create.cshtml +++ b/eShopOnWeb/eShop.MVC/Views/Catalog/Create.cshtml @@ -69,13 +69,6 @@ -
- @Html.LabelFor(model => model.RestockThreshold, htmlAttributes: new { @class = "control-label col-md-2" }) -
- @Html.EditorFor(model => model.RestockThreshold, new { htmlAttributes = new { @class = "form-control" } }) -
-
-
@Html.LabelFor(model => model.MaxStockThreshold, htmlAttributes: new { @class = "control-label col-md-2" })
diff --git a/eShopOnWeb/eShop.MVC/Views/Catalog/Delete.cshtml b/eShopOnWeb/eShop.MVC/Views/Catalog/Delete.cshtml index 9b276a0..51dedc9 100644 --- a/eShopOnWeb/eShop.MVC/Views/Catalog/Delete.cshtml +++ b/eShopOnWeb/eShop.MVC/Views/Catalog/Delete.cshtml @@ -66,14 +66,6 @@ @Html.DisplayFor(model => model.AvailableStock) -
- @Html.DisplayNameFor(model => model.RestockThreshold) -
- -
- @Html.DisplayFor(model => model.RestockThreshold) -
-
@Html.DisplayNameFor(model => model.MaxStockThreshold)
diff --git a/eShopOnWeb/eShop.MVC/Views/Catalog/Edit.cshtml b/eShopOnWeb/eShop.MVC/Views/Catalog/Edit.cshtml index f98d74f..072ef8a 100644 --- a/eShopOnWeb/eShop.MVC/Views/Catalog/Edit.cshtml +++ b/eShopOnWeb/eShop.MVC/Views/Catalog/Edit.cshtml @@ -72,13 +72,6 @@
-
- @Html.LabelFor(model => model.RestockThreshold, htmlAttributes: new { @class = "control-label col-md-4" }) -
- @Html.EditorFor(model => model.RestockThreshold, new { htmlAttributes = new { @class = "form-control" } }) -
-
-
@Html.LabelFor(model => model.MaxStockThreshold, htmlAttributes: new { @class = "control-label col-md-4" })