示例#1
0
        public ActionResult Edit(int id)
        {
            var dao      = new LoaiHangDao();
            var loaihang = dao.ViewDentail(id);

            return(View(loaihang));
        }
示例#2
0
        // GET: Admin/LoaiHang/Edit/5
        public ActionResult Edit(int id)
        {
            var ls = new LoaiHangDao().ViewDetail(id);

            SetViewBag();
            return(View(ls));
        }
示例#3
0
        public PartialViewResult Category()
        {
            var dao = new LoaiHangDao();
            var ls  = dao.GetAll();

            return(PartialView("_Category", ls));
        }
示例#4
0
        // GET: Admin/LoaiHang
        public ActionResult Index(string searchStr, int page = 1, int pageSize = 8)
        {
            var ls = new LoaiHangDao().GetByStr(searchStr, page, pageSize);

            ViewBag.searchStr = searchStr;

            return(View(ls));
        }
示例#5
0
        public ActionResult DanhSachLoaiMatHang(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new LoaiHangDao();
            var model = dao.LayTatCaDS(searchString, page, pageSize);

            ViewBag.SearchString = searchString;
            return(View(model));
        }
示例#6
0
        public ActionResult Delete(int id)
        {
            var lh = new LoaiHangDao().ViewDetail(id);

            if (lh == null)
            {
                return(HttpNotFound("Error"));
            }
            return(View(lh));
        }
示例#7
0
 public ActionResult Edit(LOAIHANG lh)
 {
     if (ModelState.IsValid)
     {
         var    dao         = new LoaiHangDao();
         string tenloaihang = Common.Utility.ChangeChar(lh.loai);
         lh.link = "/" + Common.Utility.ConvertTitle(tenloaihang);
         if (dao.Update(lh) == true)
         {
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("", "Thêm thất bại");
         }
     }
     return(View());
 }
示例#8
0
 public ActionResult Edit(LoaiHang qh)
 {
     if (ModelState.IsValid)
     {
         var dao    = new LoaiHangDao();
         var result = dao.ChinhSua(qh);
         if (result)
         {
             SetAlert("Cập nhật thành công", "success");
             return(RedirectToAction("DanhSachLoaiMatHang", "LoaiHang"));
         }
         else
         {
             ModelState.AddModelError("", "Cập nhật thất bại");
         }
     }
     return(View("Index"));
 }
示例#9
0
 public ActionResult ThemMoi(LoaiHang lh)
 {
     if (lh.TenLoaiHang != null)
     {
         var dao = new LoaiHangDao();
         int id  = dao.ThemMoi(lh);
         if (id > 0)
         {
             SetAlert("Thêm quyền thành công", "success");
             return(RedirectToAction("DanhSachLoaiMatHang", "LoaiHang"));
         }
         else
         {
             return(RedirectToAction("ThemMoi", "LoaiHang"));
         }
     }
     return(View());
 }
示例#10
0
        public void SetViewBag(int?selectedId = null)
        {
            var dao = new LoaiHangDao();

            ViewBag.MaLoaiHang = new SelectList(dao.GetAll(), "ma", "loai", selectedId);
        }
        public void SetViewBag(int?selectedMa = null)
        {
            var dao = new LoaiHangDao();

            ViewBag.MaLoaiHang = new SelectList(dao.ListAll(), "MaLoaiHang", "TenLoaiHang", selectedMa);
        }