forked from microsoftgraph/aspnet-snippets-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResultsViewModel.cs
48 lines (37 loc) · 1.42 KB
/
ResultsViewModel.cs
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
/*
* Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license.
* See LICENSE in the source repository root for complete license information.
*/
using System.Collections.Generic;
using System.Linq;
namespace Microsoft_Graph_ASPNET_Snippets.Models
{
// An entity, such as a user, group, or message.
public class ResultsItem
{
// The ID and display name for the entity's radio button.
public string Id { get; set; }
public string Display { get; set; }
// The properties of an entity that display in the UI.
public Dictionary<string, object> Properties;
public ResultsItem()
{
Properties = new Dictionary<string, object>();
}
}
// View model to display a collection of one or more entities returned from the Microsoft Graph.
public class ResultsViewModel
{
// Set to false if you don't want to display radio buttons with the results.
public bool Selectable { get; set; }
// The list of entities to display.
public IEnumerable<ResultsItem> Items { get; set; }
public ResultsViewModel(bool selectable = true)
{
// Indicates whether the results should display radio buttons.
// This is how an entity ID is passed to methods that require it.
Selectable = selectable;
Items = Enumerable.Empty<ResultsItem>();
}
}
}