コード例 #1
0
 public ActionResult Edit(int id, SanPham sp)
 {
     // TODO: Add update logic here
     using (var db = new ASP_OnlineShopConnectionDB())
     {
         db.Update <SanPham>("SET TenSanPham=@0, GiaBan=@1, SoLuong=@2, NgayNhap=@3, HinhUrl=@4, MoTa=@5, DaXoa=@6 WHERE MaSanPham=@7", sp.TenSanPham, sp.GiaBan, sp.SoLuong, sp.NgayNhap, sp.HinhUrl, sp.MoTa, sp.DaXoa, id);
     }
     return(RedirectToAction("Index"));
 }
コード例 #2
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         using (var db = new ASP_OnlineShopConnectionDB())
         {
             //db.Delete("SanPham", id.ToString(), sp);
             db.Update <SanPham>("SET DaXoa=1 WHERE MaSanPham=@0", id);
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }