Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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