public ActionResult Delete(int thingId) { var product = repository.Things .Where(prod => prod.ThingId == thingId) .FirstOrDefault(); if (product != null) { repository.DeleteThing(product); TempData["message"] = string.Format("{0} has been deleted", product.Name); } return(RedirectToAction("Index")); }