public ICommandResult Handler(CreateUserListaCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "sem sucesso", command.Notifications));
            }

            var lista = _listaRepository.GetById(command.IdLista);

            var user = _userRepository.GetById(command.IdUser);

            var userList = new UserListaEntity(
                command.Register, command.IdUser, command.IdLista);

            //userList.ListaId = lista.Id;
            //userList.UserId = user.Id;
            //userList.Register = command.Register;
            //userList.Lista = lista;
            //userList.User = user;

            _userListaRepository.CreateUserList(userList);

            return(new GenericCommandResult(true, "Sucesso", userList));
        }
Example #2
0
        public ListaEntity GetAllById([FromServices] IListaRepository repository, Guid id)
        {
            //var user = repository.GetByIdFacebook(idFacebook);

            var result = repository.GetById(id);

            return(result);
        }
Example #3
0
        public ICommandResult Handler(GetByIdCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "Sem sucesso", command.Notifications));
            }

            var item = _listaRepository.GetById(command.Id);

            return(new GenericCommandResult(true, "sucesso", item));
        }
Example #4
0
        public ICommandResult Handler(DeleteListaCommand command)
        {
            command.Validate();
            if (command.Invalid)
            {
                return(new GenericCommandResult(false, "Alguma coisa deu errado", command.Notifications));
            }

            var lista = _listaRepository.GetById(command.IdList);

            _listaRepository.DeleteLista(lista);

            return(new GenericCommandResult(true, "sucesso", ""));
        }
Example #5
0
 Pe05_Lista ObtenerListaId(long id)
 => _listaRepository.GetById <Pe05_Lista>(id);
Example #6
0
 public async Task <Lista> Consulta(int id)
 {
     return(await _listaRepository.GetById(id));
 }