From a544e889ef62309a3fad442a4f3df461527f1b52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 7 Dec 2021 17:09:23 +0300 Subject: [PATCH] Created BasketWidgetViewComponent --- .../Basket/BasketWidgetViewComponent.cs | 15 ++++ .../Components/Basket/Default.cshtml | 3 + .../EShopOnAbp.PublicWeb/Pages/Catalog.cshtml | 77 +++++++++++-------- .../EShopOnAbp.PublicWeb/Pages/Index.cshtml | 8 +- 4 files changed, 67 insertions(+), 36 deletions(-) create mode 100644 apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/BasketWidgetViewComponent.cs create mode 100644 apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/BasketWidgetViewComponent.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/BasketWidgetViewComponent.cs new file mode 100644 index 00000000..1f7090ef --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/BasketWidgetViewComponent.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc.UI.Widgets; + +namespace EShopOnAbp.PublicWeb.Components.Basket; + +[Widget] +public class BasketWidgetViewComponent : AbpViewComponent +{ + public async Task InvokeAsync() + { + return View("~/Components/Basket/Default.cshtml"); + } +} \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml new file mode 100644 index 00000000..1845fd64 --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml @@ -0,0 +1,3 @@ +
+

Basket content will come here!

+
\ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Catalog.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Catalog.cshtml index 4f05ea18..1efbe33f 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Catalog.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Catalog.cshtml @@ -1,46 +1,59 @@ @page +@using EShopOnAbp.PublicWeb.Components.Basket @model EShopOnAbp.PublicWeb.Pages.Catalog @{ - const int columnSize = 3; + const int productsColumnSize = 2; } + @section styles{ - + } -

Our Products

-
- @for (int i = 0; i < Math.Ceiling(Model.Products.Count / (double)columnSize); i++) - { - - @for (int j = 0; j < columnSize; j++) + +
+
+

Our Products

+
+ @for (int i = 0; i < Math.Ceiling(Model.Products.Count / (double)productsColumnSize); i++) { - - @if ((i * columnSize) + j < Model.Products.Count) + + @for (int j = 0; j < productsColumnSize; j++) { - var product = Model.Products[(i * columnSize) + j]; -
- @if (!product.ImageName.IsNullOrEmpty()) + + @if ((i * productsColumnSize) + j < Model.Products.Count) { - - } - else - { - - } -
-
-
-
@product.Name
- @product.Code - Stock count: @product.StockCount + var product = Model.Products[(i * productsColumnSize) + j]; +
+ @if (!product.ImageName.IsNullOrEmpty()) + { + + } + else + { + + } +
+
+
+
@product.Name
+ @product.Code - Stock count: @product.StockCount +
+
+
+ $@product.Price +
-
- $@product.Price -
-
-
+ } + } - + } - - } +
+
+
+

Your Basket

+
+ @await Component.InvokeAsync(typeof(BasketWidgetViewComponent)) +
+
\ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml index 16653517..5c9faabd 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml @@ -17,7 +17,7 @@

Heading

Vestibulum id ligula porta.

-

Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.

+

Donec sed odio dui. Etiam porta sem malesuada magna mollis euismod. Morbi leo risus, porta ac consectetur ac, vestibulum at eros. Praesent commodo cursus magna.

View details »

@@ -43,7 +43,7 @@

Praesent commodo cursus magna, vel scelerisque nisl consectetur. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo.

- +
@@ -54,7 +54,7 @@

Praesent commodo cursus magna, vel scelerisque nisl consectetur. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo.

- +
@@ -65,7 +65,7 @@

Praesent commodo cursus magna, vel scelerisque nisl consectetur. Vestibulum id ligula porta felis euismod semper. Fusce dapibus, tellus ac cursus commodo.

- +