public ActionResult Delete(string id, FormCollection collection)
        {
            // TODO: Add delete logic here

            SanPhamAdmin.XoaSanPham(id);
            return(RedirectToAction("Index"));
        }
 public ActionResult Create(SanPham sp)
 {
     try
     {
         if (HttpContext.Request.Files.Count > 0)
         {
             var hpf = HttpContext.Request.Files[0];
             if (hpf.ContentLength > 0)
             {
                 string fileName             = Guid.NewGuid().ToString();
                 string fullPathWithFileName = "/asset/images/" + fileName + ".jpg";
                 hpf.SaveAs(Server.MapPath(fullPathWithFileName));
                 sp.Hinhchinh = fullPathWithFileName;
             }
         }
         // TODO: Add insert logic here
         sp.Luotview  = 0;
         sp.Tinhtrang = "0";
         SanPhamAdmin.Them(sp);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult xoatam(string id)
 {
     // TODO: Add delete logic here
     SanPhamAdmin.DeleteDS(id);
     return(RedirectToAction("Index"));
 }
 // GET: Admin/SanPhamAdmin/Create
 public ActionResult Create()
 {
     ViewBag.Maloaisanpham = new SelectList(SanPhamAdmin.LoaiSanPham(), "Maloaisanpham", "Tenloaisanpham");
     ViewBag.Manhasanxuat  = new SelectList(SanPhamAdmin.NhaSanXuat(), "Manhasanxuat", "Tennhasanxuat");
     return(View());
 }
 // GET: Admin/SanPhamAdmin
 public ActionResult Index()
 {
     return(View(SanPhamAdmin.DS()));
 }
 public ActionResult KhoiPhucTinhTrang(string id)
 {
     // TODO: Add delete logic here
     SanPhamAdmin.KhoiPhuc(id);
     return(RedirectToAction("Index"));
 }