Ejemplo n.º 1
0
        public void Handle(ExcluirClienteCommand command)
        {
            ClienteAggregate item = Get <ClienteAggregate>(command.Id);

            item.Delete();
            _session.Commit();
        }
Ejemplo n.º 2
0
        public void Handle(AtualizarClienteCommand command)
        {
            logger.Info("Handling UpdateCustomerCommand {0} ({1})", command.Id, command.ExpectedVersion);
            ClienteAggregate item = Get <ClienteAggregate>(command.Id);

            item.Update(
                command.Id,
                command.Nome,
                command.Idade,
                command.Telefones.Select(x => new TelefoneMongo()
            {
                Type     = x.Type,
                AreaCode = x.AreaCode,
                Number   = x.Number
            }).ToList(),
                command.ExpectedVersion);
            _session.Commit();
        }
Ejemplo n.º 3
0
        public void Handle(CriarClienteCommand command)
        {
            var item = new ClienteAggregate(
                command.Id,
                command.Email,
                command.Nome,
                command.Idade,
                command.Telefones.Select(x => new TelefoneMongo()
            {
                Type     = x.Type,
                AreaCode = x.AreaCode,
                Number   = x.Number
            }).ToList(),
                command.ExpectedVersion);

            _session.Add(item);
            _session.Commit();
        }