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

Unified 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 9 years, 11 months ago
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 side-by-side diff with in-line comments
Download patch
Index: Calendar.ASP.NET.MVC5/Views/Calendar/UpcomingEvents.cshtml
===================================================================
new file mode 100644
--- /dev/null
+++ b/Calendar.ASP.NET.MVC5/Views/Calendar/UpcomingEvents.cshtml
@@ -0,0 +1,81 @@
+@*
+Copyright 2015 Google Inc
+
+Licensed under the Apache License, Version 2.0(the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*@
+
+@model Calendar.ASP.NET.MVC5.Models.UpcomingEventsViewModel
+@using CalendarData = Google.Apis.Calendar.v3.Data;
+
+@{
+ ViewBag.Title = "Upcoming Events";
+}
+
+@helper FormatEventTime(CalendarData.EventDateTime when)
+{
+ // Either Date or DateTime is set, depending on whether or not the event is
+ // an all-day event.
+ if (when.DateTime == null)
+ {
+ <text>All day</text>
+ }
+ else
+ {
+ @:@when.DateTime.Value.ToShortTimeString()
+ }
+}
+@helper FormatEventLength(CalendarData.EventDateTime start, CalendarData.EventDateTime end)
+{
+ var duration = end.DateTime - start.DateTime;
+ if (duration == null)
+ {
+ <text>All day</text>
+ }
+ else
+ {
+ @:@string.Format(
+ "{0} hour{1} {2} minute{3}",
+ (int)duration.Value.TotalHours,
+ duration.Value.TotalHours >= 2 ? "s" : "",
+ (int)duration.Value.Minutes,
+ duration.Value.Minutes >= 2 ? "s" : "")
+ }
+}
+
+<h2>Upcoming Events</h2>
+
+<table class="table">
+ <thead>
+ <tr>
+ <th>Time</th>
+ <th>Length</th>
+ <th>Summary</th>
+ </tr>
+ </thead>
+
+@foreach (var group in Model.EventGroups)
+{
+ <tbody>
+ <tr><th colspan="4">@group.GroupTitle</th></tr>
+ @foreach (var item in group.Events)
+ {
+ <tr>
+ <td>@FormatEventTime(item.Start)</td>
+ <td>@FormatEventLength(item.Start, item.End)</td>
+ <td>@item.Summary</td>
+ </tr>
+ }
+ </tbody>
+}
+
+</table>
« 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