Beispiel #1
0
        public ActionResult delete(HT_TieuChi_ChiSo tccs)
        {
            if (String.IsNullOrEmpty(tccs.NoiDung) || String.IsNullOrEmpty(tccs.GuiID))
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Missing info"
                }, JsonRequestBehavior.AllowGet));
            }

            var check = db.HT_TieuChi_ChiSo.Where(p => p.GuiID == tccs.GuiID).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));
        }
Beispiel #2
0
        public ActionResult create(HT_TieuChi_ChiSo tccs, string idtc)
        {
            if (String.IsNullOrEmpty(tccs.NoiDung))
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Missing info"
                }, JsonRequestBehavior.AllowGet));
            }

            var check = db.HT_TieuChi_ChiSo.Where(p => p.GuiID == tccs.GuiID).FirstOrDefault();

            if (check != null)
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Đã tồn tại"
                }, JsonRequestBehavior.AllowGet));
            }

            //kiem tra neu  la nam hoc hien tai thi xoa nhưng cai con lai
            tccs.GuiID     = Guid.NewGuid().ToString();
            tccs.IDTieuChi = idtc;
            db.HT_TieuChi_ChiSo.Add(tccs);
            db.SaveChanges();

            return(Json(new ResultInfo()
            {
                error = 0, msg = "", data = tccs
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public ActionResult edit(HT_TieuChi_ChiSo tccs, string idtc)
        {
            if (String.IsNullOrEmpty(tccs.NoiDung))
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Missing info"
                }, JsonRequestBehavior.AllowGet));
            }

            var check = db.HT_TieuChi_ChiSo.Where(p => p.GuiID == tccs.GuiID).FirstOrDefault();

            if (check == null)
            {
                return(Json(new ResultInfo()
                {
                    error = 1, msg = "Không tìm thấy thông tin"
                }, JsonRequestBehavior.AllowGet));
            }

            check.NoiDung   = tccs.NoiDung;
            check.IDTieuChi = idtc;
            check.ChiSo     = tccs.ChiSo;
            check.NoiDung   = tccs.NoiDung;
            check.YeuCau    = tccs.YeuCau;
            check.GoiY      = tccs.GoiY;

            db.Entry(check).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            return(Json(new ResultInfo()
            {
                error = 0, msg = "", data = check
            }, JsonRequestBehavior.AllowGet));
        }