// GET: Admin/LoaiAo public ActionResult Index(string searchStr, int page = 1, int pageSize = 8) { var ls = new LoaiAoDao().GetByStr(searchStr, page, pageSize); ViewBag.searchStr = searchStr; return(View(ls)); }
public ActionResult DeleteConfirmed(int id) { var dao = new LoaiAoDao(); if (dao.Delete(id) == true) { return(RedirectToAction("Index")); } else { ModelState.AddModelError("", "Xóa thất bại"); } return(View()); }
public ActionResult Edit(LOAIAO lA) { var dao = new LoaiAoDao(); lA.metatitle = Common.Utility.ConvertTitle(lA.loaiao1); lA.link = "/" + lA.metatitle; if (dao.Update(lA)) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(" ", "Sửa thất bại"); } return(View()); }
public ActionResult Create(LOAIAO lA) { var dao = new LoaiAoDao(); lA.metatitle = Common.Utility.ConvertTitle(lA.loaiao1); lA.link = "/" + Common.Utility.ConvertTitle(lA.metatitle); int res = dao.Insert(lA); if (res > 0) { return(RedirectToAction("Index")); } else { ModelState.AddModelError(" ", "Thêm thất bại"); } return(View()); }
public void SetViewBag(int?selectedId = null) { var dao = new LoaiAoDao(); ViewBag.MaLoaiAo = new SelectList(dao.GetAll(), "ma", "loaiao1", selectedId); }