Exemplo n.º 1
0
        public ICommandResult Handler(CreateListaCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "Alguma coisa deu errado", command.Notifications));
            }


            var newLista = new ListaEntity(
                command.Name,
                command.Start,
                command.Description,
                Guid.NewGuid().ToString().Substring(0, 7),
                command.Pass,
                command.CriadorId
                );


            _listaRepository.CreateNewLista(newLista);

            return(new GenericCommandResult(true, "Sucesso", newLista));
        }