public void Execute(object parameter) { if (!Classes.Functions.CheckConnection()) { messenger.Send(new NotConnectionMessage()); return; } if (parameter is RegisterHelpClass userData) { var storedUser = dbUser.GetUserByModel(userData.User); if (storedUser != null) { if (storedUser.Username == userData.User.Username) { messenger.Send(new UserExistMessage() { Message = "User with this username already exist" }); } else { messenger.Send(new UserExistMessage() { Message = "User with this email already exist" }); } } else { var userAdded = dbUser.AddUser(userData.User); messenger.Send(new SignInApprovedMessage() { SignInType = SignInType.Register, UserId = userAdded.Id }); messenger.Send(new LogInChangedMessage() { UserId = userAdded.Id, SignLogCode = SignLogCode.Registered }); } } }
/// <summary> /// Calls the method AddUser from the dbUser /// </summary> /// <param name="user">the user object</param> public void AddUser(User user) { dbUser.AddUser(user); }