Пример #1
0
        public async Task <ActionResult <dynamic> > GetAll()
        {
            UserEntity entity = new UserEntity();

            entity.Username = "******";
            entity.Password = "******";

            var user = UserRepository.Get(entity.Username, entity.Password);


            if (user == null)
            {
                return(NotFound(new { message = "Usuário ou senha inválidos" }));
            }

            var token = new TokenService();

            token.GenerateToken(entity);

            var response = new ConsultaCompraResponse
            {
                StatusCode = StatusCodes.Status200OK,
                Data       = compraRepository.GetAll()
            };

            return(new
            {
                user = user,
                message = response
            });
        }
Пример #2
0
 public IEnumerable <CompraDTO> Get()
 {
     return(_compraRepository.GetAll().Select(x => new CompraDTO()
     {
         APROVADO = x.APROVADO,
         COD_COMPRA = x.COD_COMPRA,
         DATA_SOLICITACAO = x.DATA_SOLICITACAO,
         DESCRICAO = x.DESCRICAO,
         FINALIZADO = x.FINALIZADO,
         STATUS = _statusRepository.Get(x.COD_STATUS),
         USUARIO = _usuarioRepository.Get(x.COD_USUARIO),
         TITULO = x.TITULO,
         CATEGORIA = _categoriaRepository.Get(x.COD_CATEGORIA),
         ORCAMENTO = _orcamentoRepository.GetOrcamentoByCompra(x.COD_COMPRA).ToList()
     }));
 }
Пример #3
0
 public async Task <ResponseCluster <IEnumerable <Compra> > > GetAll(int pageIndex, int pageSize)
 {
     return(await repository.GetAll(pageIndex, pageSize));
 }