public ActionResult UpdateGrid(string hiddenSchoolFilter, string hiddenSchoolYearFilter) { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); ClassService classService = new ClassService(siteUser, db); SchoolService schoolService = new SchoolService(siteUser, db); ModelServices modelService = new ModelServices(); ViewBag.DistrictDesc = siteUser.Districts[0].Name; int schoolYearId = modelService.GetSchoolYearId(Convert.ToInt32(hiddenSchoolYearFilter)); ViewBag.SchoolId = modelService.DropDownDataSchool(hiddenSchoolFilter, siteUser.EdsUserId, schoolYearId, true); ViewBag.SchoolYear = schoolService.DropDownDataSchoolYear(hiddenSchoolYearFilter); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "CLASS"); return View("Index", new SiteModels() { SchoolClasses = classService.GetViewData(hiddenSchoolYearFilter, hiddenSchoolFilter) }); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }
// GET: /Classes/ public ActionResult Index() { try { dbTIREntities db = new dbTIREntities(); SiteUser siteUser = ((SiteUser)Session["SiteUser"]); ClassService classService = new ClassService(siteUser, db); SchoolService schoolService = new SchoolService(siteUser, db); ModelServices modelService = new ModelServices(); string currentSchoolYear = schoolService.GetCurrentSchoolYear(); ViewBag.DistrictDesc = siteUser.Districts[0].Name; int schoolYearId = modelService.SchoolYearId(); ViewBag.SchoolId = modelService.DropDownDataSchool("", siteUser.EdsUserId, schoolYearId, true); ViewBag.SchoolYear = schoolService.DropDownDataSchoolYear(currentSchoolYear); ViewBag.AllowEdit = HelperService.AllowUiEdits(siteUser.RoleDesc, "CLASS"); return View(new SiteModels() { SchoolClasses = classService.GetViewData(currentSchoolYear, "", "") }); } catch (Exception ex) { Logging log = new Logging(); log.LogException(ex); return View("GeneralError"); } }