Ejemplo n.º 1
0
        public ActionResult deleteth(DM_HocSinhTH hs)
        {
            if (String.IsNullOrEmpty(hs.NamHoc))
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Missing info"
                }, JsonRequestBehavior.AllowGet));
            }

            var check = db.DM_HocSinhTH.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));
        }
Ejemplo n.º 2
0
        public ActionResult createth(DM_HocSinhTH hs)
        {
            if (String.IsNullOrEmpty(hs.NamHoc))
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Missing info"
                }, JsonRequestBehavior.AllowGet));
            }

            var check = db.DM_HocSinhTH.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_HocSinhTH.Add(hs);

            db.SaveChanges();
            return(Json(new ResultInfo()
            {
                error = 0, msg = "", data = hs
            }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public ActionResult editth(DM_HocSinhTH hs)
        {
            if (String.IsNullOrEmpty(hs.NamHoc))
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Missing info"
                }, JsonRequestBehavior.AllowGet));
            }

            var check = db.DM_HocSinhTH.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.Lop1         = hs.Lop1;
            check.Lop2         = hs.Lop2;
            check.Lop3         = hs.Lop3;
            check.Lop4         = hs.Lop4;
            check.Lop5         = hs.Lop5;
            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));
        }