change header to partial

This commit is contained in:
Quique Fernandez 2016-12-29 17:27:42 +01:00
parent 78265984af
commit 8496748453
3 changed files with 2 additions and 27 deletions

View File

@ -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));
}
}
}

View File

@ -1,4 +1,5 @@
@using Microsoft.eShopOnContainers.WebMVC.Services
@using Microsoft.eShopOnContainers.WebMVC.Models
@model Microsoft.eShopOnContainers.WebMVC.Models.Basket
@inject IIdentityParser<ApplicationUser> UserManager
@ -9,7 +10,7 @@
<form method="post" id="cartForm">
<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) })
</div>