示例#1
0
        public async Task <ActionResult> Delete(int id)
        {
            var exists = await context.Customers.AnyAsync(x => x.Id == id);

            if (!exists)
            {
                return(NotFound());
            }

            context.Remove(new Customer()
            {
                Id = id
            });
            await context.SaveChangesAsync();

            return(NoContent());
        }