The basics of the site are working.
This commit is contained in:
parent
2fdc6e2fd9
commit
a4a5cd8c45
@ -133,6 +133,11 @@
|
||||
<Content Include="Contact.aspx" />
|
||||
<Content Include="Content\bootstrap.css" />
|
||||
<Content Include="Content\bootstrap.min.css" />
|
||||
<Content Include="Content\fake_product_01.png" />
|
||||
<Content Include="Content\fake_product_02.png" />
|
||||
<Content Include="Content\fake_product_03.png" />
|
||||
<Content Include="Content\fake_product_04.png" />
|
||||
<Content Include="Content\fake_product_05.png" />
|
||||
<Content Include="Content\Site.css" />
|
||||
<Content Include="Default.aspx" />
|
||||
<Content Include="favicon.ico" />
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms._Default" %>
|
||||
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Microsoft.eShopOnContainers.Catalog.WebForms._Default" Async="true" %>
|
||||
|
||||
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
|
||||
@ -38,5 +38,73 @@
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<asp:ListView ID="catalogList" runat="server"
|
||||
DataKeyNames="Id" GroupItemCount="4"
|
||||
ItemType="eShopOnContainers.Core.Models.Catalog.CatalogItem">
|
||||
<EmptyDataTemplate>
|
||||
<table >
|
||||
<tr>
|
||||
<td>Well, there's nothing in the catalog.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</EmptyDataTemplate>
|
||||
<EmptyItemTemplate>
|
||||
<td/>
|
||||
</EmptyItemTemplate>
|
||||
<GroupTemplate>
|
||||
<tr id="itemPlaceholderContainer" runat="server">
|
||||
<td id="itemPlaceholder" runat="server"></td>
|
||||
</tr>
|
||||
</GroupTemplate>
|
||||
<ItemTemplate>
|
||||
<td runat="server">
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="ProductDetails.aspx?productID=<%#:Item.Id%>">
|
||||
<img src="<%#:Item.PictureUri%>"
|
||||
style="border: solid" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="ProductDetails.aspx?productID=<%#:Item.Id%>">
|
||||
<span>
|
||||
<%#:Item.Name%>
|
||||
</span>
|
||||
</a>
|
||||
<br />
|
||||
<span>
|
||||
<b>Price: </b><%#:String.Format("{0:c}", Item.Price)%>
|
||||
</span>
|
||||
<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</td>
|
||||
</ItemTemplate>
|
||||
<LayoutTemplate>
|
||||
<table style="width:100%;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<table id="groupPlaceholderContainer" runat="server" style="width:100%">
|
||||
<tr id="groupPlaceholder"></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</LayoutTemplate>
|
||||
</asp:ListView>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
@ -1,6 +1,11 @@
|
||||
using System;
|
||||
using Autofac;
|
||||
using Autofac.Core;
|
||||
using eShopOnContainers.Core.Models.Catalog;
|
||||
using eShopOnContainers.Core.Services.Catalog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
@ -9,6 +14,29 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms
|
||||
{
|
||||
public partial class _Default : Page
|
||||
{
|
||||
private ILifetimeScope scope;
|
||||
|
||||
private ICatalogService catalog;
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
RegisterAsyncTask(new PageAsyncTask(LoadCatalogData));
|
||||
|
||||
base.OnLoad(e);
|
||||
}
|
||||
|
||||
private async Task LoadCatalogData()
|
||||
{
|
||||
var container = Application.Get("container") as IContainer;
|
||||
using (scope = container?.BeginLifetimeScope())
|
||||
{
|
||||
catalog = container?.Resolve<ICatalogService>();
|
||||
var collection = await catalog?.GetCatalogAsync();
|
||||
catalogList.DataSource = collection;
|
||||
catalogList.DataBind();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
@ -11,5 +11,14 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms {
|
||||
|
||||
|
||||
public partial class _Default {
|
||||
|
||||
/// <summary>
|
||||
/// catalogList control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.ListView catalogList;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Autofac;
|
||||
using eShopOnContainers.Core.Services.Catalog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@ -11,15 +13,19 @@ namespace Microsoft.eShopOnContainers.Catalog.WebForms
|
||||
{
|
||||
public class Global : HttpApplication
|
||||
{
|
||||
|
||||
void Application_Start(object sender, EventArgs e)
|
||||
{
|
||||
// Code that runs on application startup
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
|
||||
// TODO: CONTENT on this
|
||||
// Register Containers:
|
||||
|
||||
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<CatalogMockService>().As<ICatalogService>();
|
||||
var container = builder.Build();
|
||||
Application.Add("container", container);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user