Created
August 8, 2013 20:22
-
-
Save thefringeninja/6188333 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
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