Skip to content

Commit 848431e

Browse files
committed
Update instructions for get calendar data part of tutorial
1 parent 9fc1ec3 commit 848431e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

Demos/03-add-msgraph/graph-tutorial/Controllers/CalendarController.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ public class CalendarController : BaseController
1414
public async Task<ActionResult> Index()
1515
{
1616
var events = await GraphHelper.GetEventsAsync();
17+
18+
19+
foreach (var ev in events)
20+
{
21+
ev.Start.DateTime = DateTime.Parse(ev.Start.DateTime).ToLocalTime().ToString();
22+
ev.Start.TimeZone = TimeZoneInfo.Local.Id;
23+
ev.End.DateTime = DateTime.Parse(ev.End.DateTime).ToLocalTime().ToString();
24+
ev.End.TimeZone = TimeZoneInfo.Local.Id;
25+
}
26+
1727
return View(events);
1828
}
1929
}

tutorial/add-ms-graph.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,15 @@ namespace graph_tutorial.Controllers
9090
public async Task<ActionResult> Index()
9191
{
9292
var events = await GraphHelper.GetEventsAsync();
93+
94+
foreach (var ev in events)
95+
{
96+
ev.Start.DateTime = DateTime.Parse(ev.Start.DateTime).ToLocalTime().ToString();
97+
ev.Start.TimeZone = TimeZoneInfo.Local.Id;
98+
ev.End.DateTime = DateTime.Parse(ev.End.DateTime).ToLocalTime().ToString();
99+
ev.End.TimeZone = TimeZoneInfo.Local.Id;
100+
}
101+
93102
return Json(events, JsonRequestBehavior.AllowGet);
94103
}
95104
}

0 commit comments

Comments
 (0)