UsernameExists & DuplicateEmail Helper Methods for Entity Framework MVC3 Razor Custom Member Provider C# Using LINQ
// helper method public MembershipCreateStatus UsernameExists(string username) { using (var context = new SSSEntities()) { if (context.UserProfiles.Any( u => u.UserName == username)) { return MembershipCreateStatus.DuplicateUserName; } return MembershipCreateStatus.Success; } } // helper method public MembershipCreateStatus DuplicateEmail(string email) { using (var context = new SSSEntities()) { if (context.UserProfiles.Any( u => u.Email == email)) { return MembershipCreateStatus.DuplicateEmail; } return MembershipCreateStatus.Success; } }
[SIGNATURE]