public static MembershipCreateStatus Register(string Username, string Password, string Email, bool IsApproved, string FirstName, string LastName) { MembershipCreateStatus CreateStatus; Membership.CreateUser(Username, Password, Email, null, null, IsApproved, Guid.NewGuid(), out CreateStatus); if (CreateStatus == MembershipCreateStatus.Success) { using (HomeTaskContext Context = new HomeTaskContext()) { User User = Context.Users.FirstOrDefault(Usr => Usr.Username == Username); User.FirstName = FirstName; User.LastName = LastName; Context.SaveChanges(); } if (IsApproved) { FormsAuthentication.SetAuthCookie(Username, false); } } return CreateStatus; }
public CodeFirstRoleProvider() : base() { this.Context = new HomeTaskContext(); }
public CodeFirstMembershipProvider() : base() { this.Context = new HomeTaskContext(); }