public void Register(string firstName, string lastName, string emailAddress)
        {
            // perform the "core" registration logic:
            // generate an ID
            // track the registration in our db
            var id = _idRegistry.AssignId(firstName, lastName);

            var cmd = _connection.CreateCommand();

            cmd.CommandText = "insert into ....";
            cmd.ExecuteNonQuery();

            // then, call our ID card vendor to notify them of the new member, so that they can send the ID card.
            var request = new
            {
                name = $"{firstName} {lastName}",
                id   = id
            };

            _httpClient.PostAsync("https://idcardvendor.com/api/idcard",
                                  new StringContent(JsonConvert.SerializeObject(request)));

            // send an email welcoming the new member...
            _smtpClient.Send(new MailMessage(_fromAddress, emailAddress, _subject, "Welcome, ...."));
        }
Beispiel #2
0
        public void Register(string firstName, string lastName)
        {
            // perform the "core" registration logic:
            // generate an ID
            // track the registration in our db
            var id = _idRegistry.AssignId(firstName, lastName);

            var cmd = _connection.CreateCommand();

            cmd.CommandText = "insert into ....";
            cmd.ExecuteNonQuery();

            // then, notify any other components that need to know when registrations take place.
            OnRegistration?.Invoke(this, new RegistrationEventArgs
            {
                Name = $"{firstName} {lastName}",
                Id   = id
            });
        }