GetUser Methods for Entity Framework MVC3 Razor Custom Member Provider C# Using LINQ
public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
{
using (var context = new SSSEntities())
{
UserProfile u = context.UserProfiles
.SingleOrDefault(up => up.UserId == Convert.ToInt32(providerUserKey));
MembershipUser membershipUser = GetMembershipUser(u);
return membershipUser;
}
}
public override MembershipUser GetUser(string username, bool userIsOnline)
{
using (var context = new SSSEntities())
{
UserProfile u = context.UserProfiles
.SingleOrDefault(up => up.UserName == username);
MembershipUser membershipUser = GetMembershipUser(u);
return membershipUser;
}
}
// custom method to return a UserProfile
public UserProfile GetUser(string username)
{
using (var context = new SSSEntities())
{
UserProfile u = context.UserProfiles
.SingleOrDefault(up => up.UserName == username);
return u;
}
}
// custom method to return a UserProfile
public UserProfile GetUser(object providerUserKey)
{
using (var context = new SSSEntities())
{
UserProfile u = context.UserProfiles
.SingleOrDefault(up => up.UserId == Convert.ToInt32(providerUserKey));
return u;
}
}
[SIGNATURE]