Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(762)

Side by Side Diff: Calendar.ASP.NET.MVC5/Views/Calendar/UpcomingEvents.cshtml

Issue 194980043: Issue 6: Create an ASP.Net MVC Sample Base URL: https://google-api-dotnet-client.samples.googlecode.com/hg/
Patch Set: Addressed peleyal's comments Created 8 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 @*
2 Copyright 2015 Google Inc
3
4 Licensed under the Apache License, Version 2.0(the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 *@
16
17 @model Calendar.ASP.NET.MVC5.Models.UpcomingEventsViewModel
18 @using CalendarData = Google.Apis.Calendar.v3.Data;
19
20 @{
21 ViewBag.Title = "Upcoming Events";
22 }
23
24 @helper FormatEventTime(CalendarData.EventDateTime when)
25 {
26 // Either Date or DateTime is set, depending on whether or not the event is
27 // an all-day event.
28 if (when.DateTime == null)
29 {
30 <text>All day</text>
31 }
32 else
33 {
34 @:@when.DateTime.Value.ToShortTimeString()
35 }
36 }
37 @helper FormatEventLength(CalendarData.EventDateTime start, CalendarData.EventDa teTime end)
38 {·
39 var duration = end.DateTime - start.DateTime;
40 if (duration == null)
41 {
42 <text>All day</text>
43 }
44 else
45 {
46 @:@string.Format(
47 "{0} hour{1} {2} minute{3}",
48 (int)duration.Value.TotalHours,
49 duration.Value.TotalHours >= 2 ? "s" : "",
50 (int)duration.Value.Minutes,
51 duration.Value.Minutes >= 2 ? "s" : "")
52 }
53 }
54
55 <h2>Upcoming Events</h2>
56
57 <table class="table">
58 <thead>
59 <tr>
60 <th>Time</th>
61 <th>Length</th>
62 <th>Summary</th>
63 </tr>
64 </thead>
65
66 @foreach (var group in Model.EventGroups)
67 {
68 <tbody>
69 <tr><th colspan="4">@group.GroupTitle</th></tr>
70 @foreach (var item in group.Events)
71 {
72 <tr>
73 <td>@FormatEventTime(item.Start)</td>
74 <td>@FormatEventLength(item.Start, item.End)</td>
75 <td>@item.Summary</td>
76 </tr>
77 }
78 </tbody>
79 }
80
81 </table>
OLDNEW
« no previous file with comments | « Calendar.ASP.NET.MVC5/Views/Account/_ExternalLoginsListPartial.cshtml ('k') | Calendar.ASP.NET.MVC5/Views/Home/Index.cshtml » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b