This repository was archived by the owner on Jul 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 63
Expand file tree
/
Copy pathIndex.cshtml
More file actions
52 lines (46 loc) · 1.53 KB
/
Index.cshtml
File metadata and controls
52 lines (46 loc) · 1.53 KB
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
51
52
@using System.Collections
@model WebAppGraphAPI.Models.UserProfile
@{
ViewBag.Title = "User Profile";
}
<h2>@ViewBag.Title.</h2>
<table class="table table-bordered table-striped">
@{
var type = Model.GetType();
var properties = type.GetProperties();
var collections = new List<Type>() { typeof(IEnumerable<>), typeof(IEnumerable) };
foreach (var property in properties)
{
<tr>
<td>@property.Name</td>
<td>
@{
if (property.PropertyType != typeof(string) && property.PropertyType.GetInterfaces().Any(i => collections.Any(c => i == c)))
{
var list = (IList)property.GetValue(Model, null);
if (list != null)
{
foreach (var value in list)
{
@value<br />
}
}
}
else
{
@property.GetValue(Model, null)
}
}
</td>
</tr>
}
}
</table>
@if (ViewBag.ErrorMessage == "AuthorizationRequired")
{
<p>You have to sign-in to see your profile. Click @Html.ActionLink("here", "Index", "UserProfile", new { reauth = true }, null) to sign-in.</p>
}
@if (ViewBag.ErrorMessage == "UnexpectedError")
{
<p>An unexpected error occurred while retrieving your profile. Please try again. You may need to sign-in.</p>
}