foxxtrot (owner)

Revisions

gist: 100909 Download_button fork
public
Public Clone URL: git://gist.github.com/100909.git
Embed All Files: show embed
WorkingAttempt.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
interface IAuthorization
{
String Item1 { get; set; }
String Item2 { get; set; }
String Item3 { get; set; }
}
 
public class App1Authorization
{
String Item1 { get; set; }
String Item2 { get; set; }
String Item3 { get { return null; } set {/* Do Nothing */} }
}
 
public class UserAuthorizations<T> where T : IAuthorization
{
public String UserName { get; set; }
public int UserId { get; set; }
public List<T> Authorizations { get; set; }
}
 
public UserAuthorizations<App1Authorization> GetApp1Authorizations(int UserId)
{
return (from u in _context.Users
where u.WsuId == UserId
select new UserAuthorizations<App1Authorization>
{
UserName = u.FullName,
UserId = UserId,
Authorizations = (from ca in _context.App1Authorizations
where ca.UserWsuId == UserId
select new App1Authorization
{
Item1 = ca.Item1,
Item2 = ca.Item2
}).ToList()
}).Single();
}