Skip to content

Instantly share code, notes, and snippets.

@thefringeninja
Created August 8, 2013 20:22
Show Gist options
  • Save thefringeninja/6188333 to your computer and use it in GitHub Desktop.
Save thefringeninja/6188333 to your computer and use it in GitHub Desktop.
public class MyAccount{
public string UserName{get;set;}
public Guid Id{get;set;}
public IEnumerable<MyBullShitClaimEntity> Claims{get;set;}
public int EPenisSize{get;set;}
}
public class MyUserIdentity : IUserIdentity {
public string UserName{get;set; }
public IEnumerable<string> Claims{get;set;}
public string AwesomenessFactor{get;set;}
public MyUserIdentity(IUserIdentity userIdentity) {
UserName = userIdentity.UserName;
Claims = userIdentity.Claims;
AwesomenessFactor = "unknown";
}
public MyUserIdentity(MyAccount account) {
Claims = (from claim in account.Claims select claim.Value).ToList();
UserName = account.UserName;
AwesomenessFactor = "I am this [" + account.EPenisSize * 10 + "] awesome."
}
}
public static MyUserIdentity AsMyIdentity(this IUserIdentity useridentity) {
if (userIdentity == null) return null;
return useridentity as MyUserIdentity ?? new MyUserIdentity(userIdentity);
}
<div class="metro bootstrap">@Html.CurrentUser.AsMyIdentity().UserName is @Html.CurrentUser.AsMyIdentity().AwesomenessFactor</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment