// // GET: /QLN/ public ActionResult Index(string searchString) { var nuoc = new QLNModel(); if (searchString == "") { SetAlert("Vui lòng nhập nội dung tìm kiếm", "error"); } var model = nuoc.ListWhereAll(searchString); @ViewBag.SearchString = searchString; return(View(model)); }
public ActionResult Edit(NUOC nuoc) { if (ModelState.IsValid) { var dao = new QLNModel(); var result = dao.Update(nuoc); if (result) { SetAlert("Cập nhật thông tin nước thành công", "success"); return(RedirectToAction("Index", "QLN")); } else { ModelState.AddModelError("", "Cập nhật thông tin nước không thành công"); } } return(View()); }
public ActionResult Create(NUOC nuoc) { if (ModelState.IsValid) { var dao = new QLNModel(); if (dao.Find(nuoc.MaNuoc) != null) { SetAlert("Mã nước đã tồn tại", "error"); return(RedirectToAction("Create", "QLN")); } String result = dao.Insert(nuoc); if (!String.IsNullOrEmpty(result)) { SetAlert("Thêm nước thành công", "success"); return(RedirectToAction("Index", "QLN")); } else { ModelState.AddModelError("", "Thêm nước không thành công"); } } return(View()); }
public ActionResult Edit(string maNuoc) { var nuoc = new QLNModel().getByMaNuoc(maNuoc); return(View(nuoc)); }