public ActionResult deletethpt(DM_HocSinhTHCS hs) { if (String.IsNullOrEmpty(hs.NamHoc)) { return(Json(new ResultInfo() { error = 1, msg = "Missing info" }, JsonRequestBehavior.AllowGet)); } var check = db.DM_HocSinhTHPT.Where(p => p.MaTruong == MaTruong && p.NamHoc == hs.NamHoc).FirstOrDefault(); if (check == null) { return(Json(new ResultInfo() { error = 1, msg = "Không tìm thấy thông tin" }, JsonRequestBehavior.AllowGet)); } db.Entry(check).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); return(Json(new ResultInfo() { error = 0, msg = "", data = check }, JsonRequestBehavior.AllowGet)); }
public ActionResult createthcs(DM_HocSinhTHCS hs) { if (String.IsNullOrEmpty(hs.NamHoc)) { return(Json(new ResultInfo() { error = 1, msg = "Missing info" }, JsonRequestBehavior.AllowGet)); } var check = db.DM_HocSinhTHCS.Where(p => p.MaTruong == MaTruong && p.NamHoc == hs.NamHoc).FirstOrDefault(); if (check != null) { return(Json(new ResultInfo() { error = 1, msg = "Đã tồn tại" }, JsonRequestBehavior.AllowGet)); } hs.MaTruong = MaTruong; db.DM_HocSinhTHCS.Add(hs); db.SaveChanges(); return(Json(new ResultInfo() { error = 0, msg = "", data = hs }, JsonRequestBehavior.AllowGet)); }
public ActionResult editthcs(DM_HocSinhTHCS hs) { if (String.IsNullOrEmpty(hs.NamHoc)) { return(Json(new ResultInfo() { error = 1, msg = "Missing info" }, JsonRequestBehavior.AllowGet)); } var check = db.DM_HocSinhTHCS.Where(p => p.MaTruong == MaTruong && p.NamHoc == hs.NamHoc).FirstOrDefault(); if (check == null) { return(Json(new ResultInfo() { error = 1, msg = "Không tìm thấy thông tin" }, JsonRequestBehavior.AllowGet)); } check.Lop6 = hs.Lop6; check.Lop7 = hs.Lop7; check.Lop8 = hs.Lop8; check.Lop9 = hs.Lop9; check.Nu = hs.Nu; check.DanToc = hs.DanToc; check.ChinhSach = hs.ChinhSach; check.KhuyetTat = hs.KhuyetTat; check.TuyenMoi = hs.TuyenMoi; check.LuuBan = hs.LuuBan; check.BoHoc = hs.BoHoc; check.HaiBuoi = hs.HaiBuoi; check.BanTru = hs.BanTru; check.NoiTru = hs.NoiTru; check.TotNghiep = hs.TotNghiep; check.TotNghiepNu = hs.TotNghiepNu; check.TotNghiepDT = hs.TotNghiepDT; check.GioiCapHuyen = hs.GioiCapHuyen; check.GioiCapTinh = hs.GioiCapTinh; check.GioiCapQG = hs.GioiCapQG; db.Entry(check).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(Json(new ResultInfo() { error = 0, msg = "", data = hs }, JsonRequestBehavior.AllowGet)); }