forked from azure-appservice-samples/BakeryTemplate
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Default.cshtml
50 lines (42 loc) · 1.95 KB
/
Default.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@{
Page.Title = "Home";
var db = Database.Open("bakery");
var products = db.Query("SELECT * FROM PRODUCTS").ToList();
var featured = products[new Random().Next(products.Count)];
}
<h1>Welcome to Build Bakery!</h1>
<div id="featuredProduct">
<img alt="Featured Product" src="~/Images/Products/@featured.ImageName"/>
<div id="featuredProductInfo">
<div id="productInfo">
<h2>@featured.Name</h2>
<p class="price">[email protected]("{0:f}", featured.Price)</p>
<p class="description">@featured.Description</p>
</div>
<div id="callToAction">
<a class="order-button" href="~/order/@featured.Id" title="Order @featured.Name">Order Now</a>
</div>
</div>
</div>
<div id="productsWrapper">
<ul id="products" data-role="listview" data-inset="true">
@foreach (var p in products) {
<li class="product">
<a href="~/order/@p.Id" title="Order @p.Name">
<img class="hide-from-desktop" src="~/Images/Products/Thumbnails/@p.ImageName" alt="Image of @p.Name" />
<div class="productInfo">
<h3>@p.Name</h3>
<img class="product-image hide-from-mobile" src="~/Images/Products/Thumbnails/@p.ImageName" alt="Image of @p.Name" />
<p class="description">@p.Description</p>
<p class="price hide-from-desktop">[email protected]("{0:f}", p.Price)</p>
</div>
</a>
<!-- Desktop only -->
<div class="action hide-from-mobile">
<p class="price">[email protected]("{0:f}", p.Price)</p>
<a class="order-button" href="~/order/@p.Id" title="Order @p.Name">Order Now</a>
</div>
</li>
}
</ul>
</div>