Exemple #1
0
        public ActionResult Create()
        {
            List <DanHMuc> dm = DanhMucMager.getAllDanhMuc();

            ViewBag.danhmuc = dm;
            return(View());
        }
Exemple #2
0
        // GET: SanPham
        public ActionResult Index()
        {
            List <DanHMuc> dm = DanhMucMager.getAllDanhMuc();

            ViewBag.danhmuc = new SelectList(dm, "MaDM", "TenDM");
            List <SanPham> lstsp = SanPhamMager.getAllSanPham();

            return(View(lstsp));
        }
Exemple #3
0
 public ActionResult Delete(int?id)
 {
     if (Ktdangnhap() == true)
     {
         return(View(DanhMucMager.GetItemById(id)));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemple #4
0
 [HttpPost] // luu thong tin nhan vien tao tai khoan nhan vien
 public ActionResult Create(DanHMuc dm)
 {
     try
     {
         DanhMucMager.insert(dm);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(RedirectToAction("Index", "Error"));
     }
 }
Exemple #5
0
 public ActionResult Edit(int id)
 {
     if (Ktdangnhap() == true)
     {
         List <DanHMuc> dm = DanhMucMager.getAllDanhMuc();
         ViewBag.danhmuc = dm;
         SanPham sp = SanPhamMager.GetSanPhamByID(id);
         return(View(sp));
     }
     else
     {
         return(RedirectToAction("Index"));
     }
 }
Exemple #6
0
 public ActionResult Edit(DanHMuc item)
 {
     try
     {
         TaiKhoan tk = (TaiKhoan)Session["USER_SESSION"];
         int      id = tk.MaTK;
         NhanVien nv = NhanVienMager.GetbyTK(id);
         item.MaNVchinhsua = nv.MaNV;
         DanhMucMager.uppdate(item);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(RedirectToAction("Edit", item.MaDM));
     }
 }
Exemple #7
0
        public ActionResult Seacrh(int?danhmuc, string TenSp, decimal?GiaNhap)
        {
            List <DanHMuc> dm = DanhMucMager.getAllDanhMuc();

            ViewBag.danhmuc = new SelectList(dm, "MaDM", "TenDM");

            List <SanPham> lstsp  = SanPhamMager.GetSPbyDM(danhmuc);
            List <SanPham> lstsp1 = SanPhamMager.GetSPbytensp(TenSp);

            lstsp.AddRange(lstsp1);

            List <SanPham> lstsp2 = SanPhamMager.GetSpByGiaNhap(GiaNhap);

            lstsp.AddRange(lstsp2);
            return(View("Index", lstsp));
        }
Exemple #8
0
        public ActionResult Index()
        {
            List <DanHMuc> lst = DanhMucMager.getAllDanhMuc();

            return(View(lst));
        }
Exemple #9
0
 public ActionResult Delete(int id, FormCollection f)
 {
     DanhMucMager.delete(id);
     return(RedirectToAction("Index"));
 }