Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ApplicationUser : IdentityUser
- {
- public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
- {
- // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
- var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
- // Add custom user claims here
- return userIdentity;
- }
- public Customer Customer { get; set; }
- [Required]
- public int CustomerId { get; set; }
- }
- public async System.Threading.Tasks.Task<bool> AddAccount(string email, int customerId)
- {
- // Asp.net User
- var user = await UserManager.FindByEmailAsync(email);
- string password = Membership.GeneratePassword(5, 1);
- if (user == null)
- {
- user = new ApplicationUser { UserName = email, Email = email, CustomerId = customerId };
- var result = await UserManager.CreateAsync(user, password);
- if (!result.Succeeded)
- {
- return false;
- }
- }
- return true;
- }
Add Comment
Please, Sign In to add comment