public ActionResult Delete(int id) { using (var context = new SiteContainer()) { var order = context.Order.First(o => o.Id == id); context.DeleteObject(order); context.SaveChanges(); } return RedirectToAction("Index"); }
public ActionResult Delete(int id) { using (var context = new SiteContainer()) { var product = context.Product.First(p => p.Id == id); ImageHelper.DeleteImage(product.ImageSource); ImageHelper.DeleteImage(product.PreviewImageSource); context.DeleteObject(product); context.SaveChanges(); return RedirectToAction("Index", "Home", new { area = "", id = "gallery" }); } }