forked from azure-appservice-samples/PhotoGalleryTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefault.cshtml
39 lines (36 loc) · 1.18 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
@{
Page.Title = "Photo Gallery";
var db = Database.Open("PhotoGallery");
var galleries = db.Query(@"SELECT Galleries.Id, Galleries.Name, COUNT(Photos.Id) AS PhotoCount
FROM Galleries LEFT OUTER JOIN Photos ON Galleries.Id = Photos.GalleryId
GROUP BY Galleries.Id, Galleries.Name").ToList();
}
<hgroup>
<h1>Galleries</h1>
@if (galleries.Count == 1) {
<h2>There is one gallery</h2>
}
else
{
<h2>There are @galleries.Count galleries.</h2>
}
</hgroup>
<ul class="thumbnails" data-role="listview">
@foreach (var gallery in galleries)
{
<li>
<a href="~/View/@gallery.Id">
<img alt="Images from @gallery.Name" src="~/Thumbnail/@gallery.Id" class="thumbnail-no-border" />
<span class="below-image">@gallery.Name</span>
<span class="image-overlay hide-from-mobile">@gallery.PhotoCount photo(s)</span>
<span class="ui-li-count hide-from-desktop">@gallery.PhotoCount</span>
</a>
</li>
}
</ul>
<p class="actions">
@if (WebSecurity.IsAuthenticated)
{
<a data-role="button" href="~/New">Create a New Gallery</a>
}
</p>