Beispiel #1
0
        public async Task <bool> Create(CreatePersonViewModel model)
        {
            var personCommand = new CreatePersonCommand(model.FirstName, model.Surname, model.Birthdate);
            var response      = await _mediator.Send(personCommand);

            if (response)
            {
                var redisEvent = new CreateRedisEvent <CreatePersonCommand>("People", personCommand);
                await _mediator.Publish(redisEvent);
            }
            return(response);
        }
Beispiel #2
0
 public async Task Handle(CreateRedisEvent <CreatePersonCommand> notification, CancellationToken cancellationToken)
 {
     var person = notification.Data.Adapt <Person>();
     await _redisRepository.Create("People", person);
 }