Пример #1
0
        public JsonResult RemoveSV(AddNewHS_LOPModel data)
        {
            ELearningDB db  = new ELearningDB();
            var         sv  = db.HocViens.Find(data.ID);
            var         lop = db.Lops.Find(data.MaLop);

            if (sv != null && lop != null)
            {
                db.Entry(sv).Collection("Lop").Load();
                sv.Lops.Remove(lop);
                db.SaveChanges();
                return(Json(new { success = true }));
            }
            else
            {
                return(Json(new { success = false }));
            }
        }
Пример #2
0
 public JsonResult Delete_CauHoi_DeThi(CauHoiDeThiModel c)
 {
     using (ELearningDB db = new ELearningDB())
     {
         try
         {
             var cauhoi = db.CauHois.Find(c.CauHoiID);
             var dethi  = db.DeThis.Find(c.DeThiID);
             db.Entry(cauhoi).Collection("DeThi").Load();
             cauhoi.DeThis.Remove(dethi);
             db.SaveChanges();
             return(Json(new { success = true }));
         }
         catch (Exception)
         {
             return(Json(new { success = false }));
         }
     }
 }