Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ASP NETWEBAPI CRUD Delete operation
[ResponseType(typeof(Customer))]
public IHttpActionResult DeleteCustomer(int id)
{
Customer customer = db.Customers.Find(id);
if (customer == null)
{
return NotFound();
}
db.Customers.Remove(customer);
db.SaveChanges();
return Ok(customer);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment