Ejemplo n.º 1
0
        public async Task <IActionResult> Delete(int customerId)
        {
            try{
                Customer customerModel = await _repo.GetCustomer(customerId);

                if (customerModel == null)
                {
                    return(NotFound());
                }
                _repo.Delete(customerModel);

                if (await _repo.SaveChangesAsync())
                {
                    return(Ok());
                }
            }
            catch (System.Exception ex)
            {
                return(this.StatusCode(StatusCodes.Status500InternalServerError, $"Banco dados falhou {ex.Message}"));
            }

            return(BadRequest());
        }