change header to partial
This commit is contained in:
parent
78265984af
commit
8496748453
@ -1,26 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Models;
|
|
||||||
using Microsoft.eShopOnContainers.WebMVC.Services;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Microsoft.eShopOnContainers.WebMVC.ViewComponents
|
|
||||||
{
|
|
||||||
public class Header : ViewComponent
|
|
||||||
{
|
|
||||||
public Header()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public Task<IViewComponentResult> InvokeAsync(string controller, string text = "Back")
|
|
||||||
{
|
|
||||||
var model = new Models.Header()
|
|
||||||
{
|
|
||||||
Controller = controller,
|
|
||||||
Text = text
|
|
||||||
};
|
|
||||||
|
|
||||||
return Task.FromResult<IViewComponentResult>(View(model));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,5 @@
|
|||||||
@using Microsoft.eShopOnContainers.WebMVC.Services
|
@using Microsoft.eShopOnContainers.WebMVC.Services
|
||||||
|
@using Microsoft.eShopOnContainers.WebMVC.Models
|
||||||
|
|
||||||
@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
|
@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
|
||||||
@inject IIdentityParser<ApplicationUser> UserManager
|
@inject IIdentityParser<ApplicationUser> UserManager
|
||||||
@ -9,7 +10,7 @@
|
|||||||
|
|
||||||
<form method="post" id="cartForm">
|
<form method="post" id="cartForm">
|
||||||
<div class="esh-basket">
|
<div class="esh-basket">
|
||||||
@await Component.InvokeAsync("Header", new { controller = "Catalog", text = "Back to catalog" })
|
@Html.Partial("_Header", new Header(){ Controller = "Catalog", Text = "Back to catalog" })
|
||||||
|
|
||||||
@await Component.InvokeAsync("CartList", new { user = UserManager.Parse(User) })
|
@await Component.InvokeAsync("CartList", new { user = UserManager.Parse(User) })
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user