// GET: School public ActionResult Index(string languageCode, string location, string url) { pageReturnData data = new pageReturnData(); data.languageCode = languageCode; using (ApplicationDbContext DB = new ApplicationDbContext()) { try { Page page = new Page(); data.page = page.getPage(7, languageCode); /// maybe add location, certianly add duplicate name check for schools edit and creation var s = DB.Schools.FirstOrDefault(ss => ss.url == url); if(s != null) { s.languageCode = languageCode; s.loadContent(DB, true); data.school = s; data.courses = Functions.getSchoolCourses(s.id, languageCode, true); } return View("school", data); } catch (Exception ex) { data.message = "Error: " + ex.Message; return View("school", data); } } }
// route japan-apartments-rent-guesthouse-homestay public ActionResult accomodation(string languageCode) { pageReturnData data = new pageReturnData(); data.languageCode = languageCode; using (ApplicationDbContext db = new ApplicationDbContext()) { try { Page page = new Page(); data.page = page.getPage(3, languageCode); } catch (Exception ex) { data.message = "Error: " + ex.Message; } } return View("Accomodation", data); }
// route terms-and-conditions public ActionResult careers(string languageCode) { pageReturnData data = new pageReturnData(); data.languageCode = languageCode; data.page = new Page(); using (ApplicationDbContext DB = new ApplicationDbContext()) { try { Page page = new Page(); data.page = page.getPage(5, languageCode); } catch (Exception ex) { data.message = "Error: " + ex.Message; } } //return Json(data,JsonRequestBehavior.AllowGet); return View("careers", data); }
// route schools public ActionResult schools(string languageCode) { pageReturnData data = new pageReturnData(); data.languageCode = languageCode; Page page = new Page(); data.page = page.getPage(6, languageCode); using (ApplicationDbContext DB = new ApplicationDbContext()) { try { data.schools = DB.Schools.Include("schoolLocation").ToList(); foreach (School s in data.schools) { s.languageCode = languageCode; s.loadContent(DB); } } catch (Exception ex) { data.message = "Error: " + ex.Message; } } //return Json(data,JsonRequestBehavior.AllowGet); return View("schools", data); }