public async Task<bool> DeleteCustomerAsync(int id)
{
//Extra hop to the database but keeps it nice and simple for this demo
var customer = await _context.Customers.SingleOrDefaultAsync(c => c.Id == id);
_context.Remove(customer);
try
{
return (await _context.SaveChangesAsync() > 0 ? true : false);
}
catch (System.Exception exp)
{
_logger.LogError($"Error in {nameof(DeleteCustomerAsync)}: " + exp.Message);
}
return false;
}