コード例 #1
0
ファイル: OrderController.cs プロジェクト: fathurxzz/aleqx
 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");
 }
コード例 #2
0
ファイル: ProductController.cs プロジェクト: fathurxzz/aleqx
 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" });
     }
 }