Esempio n. 1
0
        public async Task <IActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(BadRequest());
            }

            try {
                var dbCustomer = await customers.GetCustomerNoTracking(id);

                if (dbCustomer == null)
                {
                    return(NotFound(new { Id = id, error = "No customer with an id of " + id + " to delete." }));
                }

                await customers.DeleteCustomer(id);

                return(Ok());
            }
            catch (DbUpdateException)
            {
                return(BadRequest());
            }
        }
 public async Task Delete(int id)
 {
     await customers.DeleteCustomer(id);
 }