public ActionResult Edit(int id, nhasanxuat nsx)
        {
            //try
            //{
            //    // TODO: Add update logic here

            //    return RedirectToAction("Index");
            //}
            //catch
            //{
            //    return View();
            //}
            if (HttpContext.Request.Files.Count > 0)
            {
                var hpf = HttpContext.Request.Files[0];
                if (hpf.ContentLength > 0)
                {
                    string fileName = Guid.NewGuid().ToString();

                    string fullPathWithFileName = "~/images/home/" + fileName + ".jpg";
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName));
                    nsx.LoGoURL = fileName + ".jpg";
                }
            }
            QLNhaSanXuatbus.EditNhaSanXuat(id, nsx);
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(nhasanxuat nsx)
        {
            if (HttpContext.Request.Files.Count > 0)
            {
                var hpf = HttpContext.Request.Files[0];
                if (hpf.ContentLength > 0)
                {
                    string fileName = Guid.NewGuid().ToString();

                    string fullPathWithFileName = "~/images/home/" + fileName + ".jpg";
                    hpf.SaveAs(Server.MapPath(fullPathWithFileName));
                    nsx.LoGoURL = fileName + ".jpg";
                }
            }
            QLNhaSanXuatbus.ThemNhaSanXuat(nsx);
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 // GET: Admin/QLSanPham/Edit/5
 public ActionResult Edit(int id)
 {
     ViewBag.MaNhaSanXuat  = new SelectList(QLNhaSanXuatbus.HienThiDanhSachNSX(), "MaNhaSanXuat", "TenNhaSanXuat");
     ViewBag.MaLoaiSanPham = new SelectList(QLloaisanphambus.HienThiLoaiSanPham(), "MaLoaiSanPham", "TenLoaiSanPham");
     return(View(QLsanphambus.ChiTietSanPham(id)));
 }
Exemple #4
0
 // GET: Admin/QLSanPham/Create
 public ActionResult Create()
 {
     ViewBag.MaNhaSanXuat  = new SelectList(QLNhaSanXuatbus.HienThiDanhSachNSX(), "MaNhaSanXuat", "TenNhaSanXuat");
     ViewBag.MaLoaiSanPham = new SelectList(QLloaisanphambus.HienThiLoaiSanPham(), "MaLoaiSanPham", "TenLoaiSanPham");
     return(View());
 }
 // GET: Admin/QLNhaSanXuat/Edit/5
 public ActionResult Edit(int id)
 {
     return(View(QLNhaSanXuatbus.ChiTietNhaSanXuat(id)));
 }
        // GET: Admin/QLNhaSanXuat
        public ActionResult Index(int page = 1)
        {
            var ds = QLNhaSanXuatbus.HienThiDanhNhaSanXuat(page, 3);

            return(View(ds));
        }