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 }); }
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() })); }
public async Task <ResponseCluster <IEnumerable <Compra> > > GetAll(int pageIndex, int pageSize) { return(await repository.GetAll(pageIndex, pageSize)); }