Exemple #1
0
 // GET: Admin/QuanLySanPham/Details/5
 public ActionResult Details(string id)
 {
     return(View(QuanLyBus.ChiTietSanPham(id)));
     //var dataContext = new PetaPoco.Database("DienThoaiShopConnection");
     //var employee = dataContext.SingleOrDefault<sanpham>("Select * from sanpham where MaSanPham=@0",id);
     //return View(employee);
 }
Exemple #2
0
        public ActionResult Create(sanpham sp)
        {
            // TODO: Add insert logic here
            if (HttpContext.Request.Files.Count > 0)
            {
                var hpf = HttpContext.Request.Files[0];
                if (hpf.ContentLength > 0)
                {
                    string filename = Guid.NewGuid().ToString();

                    string fullPathWithFileName = "/images/" + filename + ".jpg";
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName));
                    sp.hinhanh = fullPathWithFileName;
                }
            }
            QuanLyBus.Them(sp);
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 public ActionResult Delete(string id, sanpham sp)
 {
     // TODO: Add delete logic here
     QuanLyBus.Xoa(id, sp);
     return(RedirectToAction("Index"));
 }