public JsonResult ChangeSubject(int idsub) { var kq = new QClassDAO().listWithIDSubInt(idsub); return Json(new { result = kq }); }
public JsonResult Delete(int idm) { var x = new QClassDAO().DeleteQClass(idm); return Json(new { result = x }); }
public ActionResult Create(QClass sub) { bool idclass = false; if (ModelState.IsValid) { var dao = new QClassDAO(); Guid id = new SubjectDAO().GetListAll().Where(i => i.idSub == sub.idQClass).Select(l => l.SubjectID).SingleOrDefault(); sub.SubjectID = id; sub.ClassID = Guid.NewGuid(); idclass = dao.AddQClass(sub); } return Json(idclass, JsonRequestBehavior.AllowGet); }
public ActionResult Edit(QClass sub) { bool kq = false; if (ModelState.IsValid) { var dao = new QClassDAO(); if (dao.UpdateQClass(sub)) { kq = true; } else { kq = false; } } return Json(kq, JsonRequestBehavior.AllowGet); }
public ActionResult Index(SubjectModel q, HttpPostedFileBase file) { q.nameModule = new QClassDAO().singleIDQClassInt(q.SelectedModule).Descr; if (file != null && file.ContentLength > 0 && q.SelectedSubject != 0) { try { string path = Path.Combine(Server.MapPath("~/Doc/" + q.nameModule), Path.GetFileName(file.FileName)); file.SaveAs(path); Guid subID = new SubjectDAO().ShowAllSubIDSingle(q.SelectedSubject).SubjectID; Guid classID = new QClassDAO().singleIDQClassInt(q.SelectedModule).ClassID; if (!SqLite2SqlServerQuestion(path, subID, classID)) { ViewBag.Message = "Không thể lưu các câu hỏi này"; } else { ViewBag.Message = "Import danh sách câu hỏi thành công!!!"; } // ViewBag.Message = "Import danh sách câu h?i thành công!!!"; } catch (Exception ex) { ViewBag.Message = "ERROR:" + ex.Message.ToString(); } } else { ViewBag.Message = "You have not specified a file."; } listmodule(q.SelectedSubject); listsubject(q.SelectedSubject); return(View()); }
public ActionResult Get(int id) { var qclass = new QClassDAO().singleIDQClassInt(id); listsubject(); return Json(qclass, JsonRequestBehavior.AllowGet); }