public ActionResult Edit(int id) { var dao = new LoaiHangDao(); var loaihang = dao.ViewDentail(id); return(View(loaihang)); }
// GET: Admin/LoaiHang/Edit/5 public ActionResult Edit(int id) { var ls = new LoaiHangDao().ViewDetail(id); SetViewBag(); return(View(ls)); }
public PartialViewResult Category() { var dao = new LoaiHangDao(); var ls = dao.GetAll(); return(PartialView("_Category", ls)); }
// 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)); }
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)); }
public ActionResult Delete(int id) { var lh = new LoaiHangDao().ViewDetail(id); if (lh == null) { return(HttpNotFound("Error")); } return(View(lh)); }
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()); }
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")); }
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()); }
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); }