public static void AddUser(Registered user) { if (Users.Any(x => x.LoginName == user.LoginName)) { throw new LoginException("The user with this login is already registered"); } else { Users.Add(user); } }
public OrderRepository(Registered user) { if (UsersReg.Users.Any(u => u.LoginName == user.LoginName)) { _user = user; } else { UsersReg.AddUser(user); _user = user; } }