public static User GetUserByID(Guid ID) { RssFeedDBConnection db = new RssFeedDBConnection(); User user = new User(); user = db.Users.SingleOrDefault(u => u.ID == ID); return user; }
public MembershipUser CreateUser(string username, string password, string email) { using (RssFeedDBConnection db = new RssFeedDBConnection()) { User user = new User(); user.ID = Guid.NewGuid(); user.UserName = username; user.Email = email; user.PasswordSolt = CreateSalt(); user.Password = CreatePasswordHash(password, user.PasswordSolt); user.CreatedDate = DateTime.Now; user.IsActivated = false; user.IsLockedOut = false; user.LastLockedOutDate = DateTime.Now; user.LastLoginDate = DateTime.Now; user.NewEmailKey = GenerateKey(); db.AddToUsers(user); db.SaveChanges(); SendEmailKey(user); return GetUser(username); } }
private void SendEmailKey(User user) { string ActivationLink = "http://*****:*****@mail.ru", user.Email) { Subject = "Activate your account", Body = ActivationLink }; var client = new SmtpClient("smtp.mail.ru"); client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "soks123"); client.Send(message); }
/// <summary> /// Create a new User object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="password">Initial value of the Password property.</param> /// <param name="email">Initial value of the Email property.</param> /// <param name="lastUpdate">Initial value of the LastUpdate property.</param> /// <param name="passwordSolt">Initial value of the PasswordSolt property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> /// <param name="lastLoginDate">Initial value of the LastLoginDate property.</param> /// <param name="isActivated">Initial value of the IsActivated property.</param> /// <param name="isLockedOut">Initial value of the IsLockedOut property.</param> /// <param name="lastLockedOutDate">Initial value of the LastLockedOutDate property.</param> public static User CreateUser(global::System.Guid id, global::System.String userName, global::System.String password, global::System.String email, global::System.DateTime lastUpdate, global::System.String passwordSolt, global::System.DateTime createdDate, global::System.DateTime lastLoginDate, global::System.Boolean isActivated, global::System.Boolean isLockedOut, global::System.DateTime lastLockedOutDate) { User user = new User(); user.ID = id; user.UserName = userName; user.Password = password; user.Email = email; user.LastUpdate = lastUpdate; user.PasswordSolt = passwordSolt; user.CreatedDate = createdDate; user.LastLoginDate = lastLoginDate; user.IsActivated = isActivated; user.IsLockedOut = isLockedOut; user.LastLockedOutDate = lastLockedOutDate; return user; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }