public ActionResult AjaxDeleteOrder(int customerId, int orderId) { try { var context = new SampleEntities(); var customer = context.Customers.Single(c => c.ID == customerId); var order = customer.Orders.Single(o => o.ID == orderId); context.DeleteObject(order); context.SaveChanges(); } catch (System.Exception e) { Response.StatusCode = 500; Response.AppendHeader("message", "There was an issue deleting order " + orderId + ". Please contact tech support with this message: " + Utility.GetInnermostException(e).Message); } return(View(new GridModel(GetOrders(customerId)))); }