forked from d4software/QueryTree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvitationViewModel.cs
More file actions
66 lines (54 loc) · 1.96 KB
/
InvitationViewModel.cs
File metadata and controls
66 lines (54 loc) · 1.96 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using QueryTree.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace QueryTree.ViewModels
{
public class InvitationViewModel
{
public InvitationViewModel()
{
DatabasesMerged = new List<string>();
DatabasesLost = new List<string>();
}
public string OrganisationName { get; set; }
public List<string> Invitees { get; set; }
public string Description
{
get
{
string inviteeSummary = string.Empty;
if (Invitees.Count == 1)
{
inviteeSummary = Invitees.First();
}
else if (Invitees.Count > 1)
{
inviteeSummary = string.Format("{0} and {1}", Invitees.First(), Invitees.Last());
}
else if (Invitees.Count > 1)
{
inviteeSummary = string.Format("{0}, and {1}", string.Join(", ", Invitees.Take(Invitees.Count - 1)), Invitees.Last());
}
string organisationName = this.OrganisationName;
if (string.IsNullOrEmpty(organisationName))
{
organisationName = "an organisation";
}
if (IsOrganisationAdmin)
{
return string.Format("You have been invited to become an administrator of {0} by {1}", organisationName, inviteeSummary);
}
else
{
return string.Format("You have been invited to join {0} by {1}", organisationName, inviteeSummary);
}
}
}
public int OrganisationId { get; set; }
public bool IsOrganisationAdmin { get; set; }
public List<string> DatabasesMerged { get; set; }
public List<string> DatabasesLost { get; set; }
}
}