Skip to content

Commit

Permalink
Section 12 - View Component in Action
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrugen committed Sep 27, 2021
1 parent 234b72e commit d076f2b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@model int

<i class="bi bi-cart"></i> &nbsp; (@Model)
15 changes: 3 additions & 12 deletions BulkyBookWeb/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,13 @@
</a>
</li>

@if (HttpContextAccessor.HttpContext.Session.GetInt32(SD.SessionCart) != null)
{
<li class="nav-item">
<a class=nav-link asp-area="Customer" asp-controller="Cart" asp-action="Index">
<i class="bi bi-cart"></i> &nbsp;
(@HttpContextAccessor.HttpContext.Session.GetInt32(SD.SessionCart))
</a>
</li>
}
else{

<li class="nav-item">
<a class=nav-link asp-area="Customer" asp-controller="Cart" asp-action="Index">
<i class="bi bi-cart"></i> &nbsp; (0)
@await Component.InvokeAsync("ShoppingCart")
</a>
</li>
}

</ul>
<partial name="_LoginPartial" />
@* <form class="d-flex">
Expand Down

0 comments on commit d076f2b

Please sign in to comment.