public async Task <IActionResult> Get(int id)
        {
            var contasAPagar = await _unitOfWork.ContasAPagar.GetByIdWithTipoContaAsync(id);

            if (contasAPagar == null)
            {
                return(NotFound());
            }
            return(Ok(ContaAPagarMapper.ModelToResource(contasAPagar)));
        }
        public async Task <IActionResult> GetAll()
        {
            var contasAPagars = await _unitOfWork.ContasAPagar.GetAllWithTipoContaAsync();

            List <ContaAPagarResource> contasAPagarResource = new List <ContaAPagarResource>();

            if (contasAPagars == null)
            {
                return(NoContent());
            }
            foreach (var contasAPagar in contasAPagars)
            {
                contasAPagarResource.Add(ContaAPagarMapper.ModelToResource(contasAPagar));
            }
            return(Ok(contasAPagarResource));
        }
        public async Task <IActionResult> Edit(int id, [FromBody] ContaAPagarResource contasAPagarResource)
        {
            try
            {
                var contasAPagar = await _unitOfWork.ContasAPagar.GetByIdAsync(id);

                if (ModelState.IsValid)
                {
                    contasAPagar = ContaAPagarMapper.ResourceToModel(contasAPagarResource, contasAPagar);
                    await _unitOfWork.CompleteAsync();

                    contasAPagar.TipoConta = await _unitOfWork.TipoContas.GetByIdAsync(contasAPagar.TipoContaId);

                    ContaAPagarMapper.ModelToResource(contasAPagar);
                }
                return(Ok(contasAPagar));
            }
            catch (Exception e)
            {
                LogError.LogErrorWithSentry(e);
                return(BadRequest(ModelState));
            }
        }