public ActionResult EditLoaiSP([Bind(Include = "MaLoai,TenLoai")] LoaiSP loai) { CategoryModel spm = new CategoryModel(); if (ModelState.IsValid) { spm.EditLoaiSP(loai); return(RedirectToAction("Index")); } return(View(loai)); }
public ActionResult EditLoaiSP([Bind(Include = "MaLoai,TenLoai")] LoaiSP loai) { CategoryModel spm = new CategoryModel(); if (ModelState.IsValid && spm.KiemTraTen(loai.TenLoai)) { TempData["EditSuccess"] = "Oke"; spm.EditLoaiSP(loai); return(RedirectToAction("Index")); } TempData["ErrorEdit"] = "Lỗi"; return(View(loai)); }