Exemplo n.º 1
0
        public async Task <IActionResult> Delete(int InvoiceId, int Id)
        {
            try
            {
                var Credit = await _repository.GetCreditAsync(InvoiceId, Id);

                if (Credit == null)
                {
                    return(NotFound());
                }

                if (await _repository.DeleteCredit(Credit))
                {
                    return(Ok());
                }
            }
            catch (Exception e)
            {
                _logger.LogError(e, e.Message);
                return(this.StatusCode(StatusCodes.Status500InternalServerError, "Database Failure"));
            }

            return(BadRequest("Failed to delete the Credit"));
        }