Created
April 24, 2009 03:22
-
-
Save foxxtrot/100909 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment