public ActionResult Delete(DeleteProductFormModel model) { var sanpham = db.SANPHAMs.FirstOrDefault(m => m.MaSP == model.MaSP); if (sanpham == null) { return(RedirectToAction("Index", "Product")); } db.SANPHAMs.Remove(sanpham); db.SaveChanges(); return(RedirectToAction("Index", "Product")); }
public ActionResult Delete(int masp) { var sanpham = db.SANPHAMs.FirstOrDefault(m => m.MaSP == masp); if (sanpham == null) { return(RedirectToAction("Index", "Product")); } var xoa = new DeleteProductFormModel(); xoa.MaSP = sanpham.MaSP; xoa.TenSP = sanpham.TenSP; return(View(xoa)); }