public ActionResult AnnouncementDetail(int id) { AnnouncementModel model = new AnnouncementModel(); ViewBag.data = new AnnouncementEntity[] { model.getAnnouncementByID(id) }; assignTitle(); return View("~/Views/Student/Announcement.cshtml"); }
public ActionResult Announcement() { if (loginStatus() == false) { return Redirect("Login"); } AnnouncementModel model = new AnnouncementModel(); List<AnnouncementEntity> list = model.getAllAnnouncements(); ViewBag.AnnouncementList = list; return View(); }
public ActionResult Announcement() { int sid = getSid(); if (sid == -1) { return Redirect("/Index/Index"); } AnnouncementModel model = new AnnouncementModel(); ViewBag.data = model.getAnnouncements(0, model.getNumberOfDisplayAnnouncement()); //get all assignTitle(); return View(); }
public ActionResult Index() { int sid = getSid(); if (sid == -1) { return Redirect("/Index/Index"); } AnnouncementModel announceModel = new AnnouncementModel(); ExamModel examModel = new ExamModel(); FileModel fileModel = new FileModel(); ViewBag.announcement = announceModel.getAnnouncements(0, 3); ViewBag.exam = examModel.getAvailableExam().Take(3); ViewBag.file = fileModel.getFiles(0, 3); assignTitle(); return View(); }
public ActionResult UpdateAnnouncement() { if (loginStatus() == false) { return Redirect("Login"); } Dictionary<string, string> response = new Dictionary<string, string>(); AnnouncementModel model = new AnnouncementModel(); try { int id = int.Parse(Request["id"]); string title = Request["title"]; string content = Request["content"]; int i = model.updateAnnouncement(id,title,content); if (i > 0) { response.Add("status", "success"); } else { response.Add("status", "failed"); response.Add("error", "update error"); } } catch { response.Add("status", "failed"); response.Add("error", "bad param"); } return Json(response); }
public ActionResult DelAnnouncement() { if (loginStatus() == false) { return Redirect("Login"); } Dictionary<string, string> response = new Dictionary<string, string>(); AnnouncementModel model = new AnnouncementModel(); try { int id = int.Parse(Request["id"]); int i = model.delAnnouncement(id); if (i > 0) { response.Add("status", "success"); } else { response.Add("status", "failed"); response.Add("error", "delete error"); } } catch { response.Add("status", "failed"); response.Add("error", "bad param"); } return Json(response); }