From 3f3d73a2715e685766c683283db265d8f7e14bcb Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Sat, 28 Jun 2025 15:41:18 -0700 Subject: [PATCH] Make img carousel work --- database/mistox.sql | 2 +- .../app/pages/store/catalog/catalog.component.html | 4 ++-- .../app/pages/store/catalog/catalog.component.ts | 14 ++++++++++++++ .../Controllers/ProductController.cs | 3 ++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/database/mistox.sql b/database/mistox.sql index efe3906..0a490a0 100755 --- a/database/mistox.sql +++ b/database/mistox.sql @@ -32,7 +32,7 @@ CREATE TABLE IF NOT EXISTS `ProductImage` ( `ImageID` int(11) NOT NULL AUTO_INCREMENT, `ProductID` int(11) NOT NULL, `Image` MEDIUMBLOB, - `Name` varchar(60) DEFAULT NULL, + `Name` varchar(200) DEFAULT NULL, PRIMARY KEY (`ImageID`,`ProductID`) ) AUTO_INCREMENT=1; diff --git a/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.html b/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.html index 178b0a5..d077d98 100644 --- a/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.html +++ b/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.html @@ -2,8 +2,8 @@
- - + +
diff --git a/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.ts b/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.ts index 0d8dd29..f97a88c 100644 --- a/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.ts +++ b/src/MistoxWebsite.Client/src/app/pages/store/catalog/catalog.component.ts @@ -40,6 +40,20 @@ export class CatalogComponent { ) }; + nextImg( prod: Product ){ + prod.curShowingIMG += 1; + if (prod.curShowingIMG == prod.images.length){ + prod.curShowingIMG = 0; + } + } + + prevImg( prod: Product ){ + prod.curShowingIMG -= 1; + if (prod.curShowingIMG == -1){ + prod.curShowingIMG = prod.images.length -1; + } + } + DeleteItem( ProductID: number ) { const body = new HttpParams() .set("productID", ProductID); diff --git a/src/MistoxWebsite.Server/Controllers/ProductController.cs b/src/MistoxWebsite.Server/Controllers/ProductController.cs index f9a9764..ff0c686 100755 --- a/src/MistoxWebsite.Server/Controllers/ProductController.cs +++ b/src/MistoxWebsite.Server/Controllers/ProductController.cs @@ -72,7 +72,8 @@ namespace MistoxWebsite.Server.Controllers { obj.Images = building.ToArray(); await _databaseService.NewProduct(obj); return true; - } catch { + } catch (Exception e) { + Console.WriteLine(e); return false; } }