public UserCreated(Guid id, DateTime timestamp, UserId userId, UserLoginInfo loginInfo, string userName, string password) { Id = id; Timestamp = timestamp; UserId = userId; LoginInfo = loginInfo; UserName = userName; Password = password; }
public async Task<ApplicationUser> FindAsync(UserLoginInfo userLoginInfo) { return _users.Values.SingleOrDefault(d => d.CanLoginWith(userLoginInfo)); }
internal bool CanLoginWith(UserLoginInfo info) { return _logins.Contains(info); }
public void Apply(UserCreated evnt) { Id = evnt.UserId.ToString(); UserName = evnt.UserName; Created = evnt.Timestamp; LoginInfo = evnt.LoginInfo; }
public UserLoginAdded(Guid id, DateTime timestamp, UserId userId, UserLoginInfo loginInfo) { Id = id; Timestamp = timestamp; UserId = userId; LoginInfo = loginInfo; }
public void Apply(UserCreated evnt) { Id = evnt.UserId.ToString(); _loginInfo = evnt.LoginInfo; }
internal void RemoveLogin(UserLoginInfo loginInfo) { if (string.IsNullOrEmpty(Id)) throw new Exception("User does not exists"); RaiseEvent(new UserLoginRemoved(Guid.NewGuid(), DateTime.Now, new UserId(Id), loginInfo)); }
public void Create(UserId userId, UserLoginInfo loginInfo, string userName, string password) { if (string.IsNullOrEmpty(Id) == false) throw new Exception("User already exists"); RaiseEvent(new UserCreated(Guid.NewGuid(), DateTime.Now, userId, loginInfo, userName, password)); }