public ActionResult sua_KQ1(KETQUA_XX kq) { var ketqua = db.KETQUA_XX.Find(kq.MA_KetQuaXX); if (ketqua == null) { return(HttpNotFound()); } if (TryUpdateModel(ketqua, "", new string[] { "MA_KetQuaXX", "KetQua_XX1" })) { try { ketqua.KetQua_XX1 = kq.KetQua_XX1; db.Entry(ketqua).State = EntityState.Modified; db.SaveChanges(); } catch (RetryLimitExceededException) { ModelState.AddModelError("", "loi"); } } var listKQ = from s in db.KETQUA_XX select s; return(RedirectToAction("ListKQ")); }
public ActionResult sua_PB1(PHONGBAN pb) { var phongban = db.PHONGBANs.Find(pb.MA_PhongBan); if (phongban == null) { return(HttpNotFound()); } if (TryUpdateModel(phongban, "", new string[] { "MA_PhongBan", "Ten_PB" })) { try { phongban.Ten_PB = pb.Ten_PB; db.Entry(phongban).State = EntityState.Modified; db.SaveChanges(); } catch (RetryLimitExceededException) { ModelState.AddModelError("", "loi"); } } var listPB = from s in db.PHONGBANs select s; return(View("ListPB", listPB)); }
public ActionResult sua_Menu1(SUB_MENU sub, FormCollection form, int?id) { ViewBag.vt1 = new SelectList(db.QUYEN_NSD.OrderBy(x => x.MA_QNSD), "MA_QNSD", "Ten_NSD"); ViewBag.main1 = new SelectList(db.MAIN_MENU.OrderBy(x => x.ID_Main), "ID_Main", "Ten_Main"); sub.MA_QNSD = form["vt1"].ToString(); sub.ID_Main = int.Parse(form["main1"].ToString()); if (!ModelState.IsValid) { return(View(sub)); } if (TryUpdateModel(sub, "", new string[] { "ID_SUB", "Ten_SUB" })) { try { db.Entry(sub).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } catch (Exception) { ModelState.AddModelError("", "Lỗi"); } } return(RedirectToAction("ListMenu")); }