// GET: /Default1/ public ActionResult Index() { int userId = ((SiteUser)Session["SiteUser"]).EdsUserId; int[] userDistricts = _modelServices.GetDistrictsByUserId(userId).ToArray(); SiteModels viewModel = new SiteModels(); viewModel.Teachers = GetViewData(userDistricts, "", "", ""); // Add drop down data viewModel.DropDown = new DropDownData(); viewModel.DropDown.District = new DistrictDropDown(_modelServices.DistrictDropDownDataByUser(userId)); viewModel.DropDown.School = new SchoolDropDown(_modelServices.DropDownAllOnly()); return View(viewModel); }
public ActionResult Search(string firstOrLastName, string hiddenDistrictFilterSearch, string hiddenSchoolFilterSearch) { int userId = ((SiteUser)Session["SiteUser"]).EdsUserId; int[] userDistricts = _modelServices.GetDistrictsByUserId(userId).ToArray(); SiteModels siteModel = new SiteModels(); siteModel.Teachers = GetViewData(userDistricts, hiddenDistrictFilterSearch, hiddenSchoolFilterSearch, firstOrLastName); // Add drop down data siteModel.DropDown = new DropDownData(); siteModel.DropDown.District = new DistrictDropDown(_modelServices.DistrictDropDownDataByUser(userId)); siteModel.DropDown.School = new SchoolDropDown(_modelServices.SchoolDropDownDataByDistrict(new int[] { Convert.ToInt32(hiddenDistrictFilterSearch) })); // Reselect drop downs siteModel.DropDown.District.SelectedDistrict = Convert.ToInt32(hiddenDistrictFilterSearch); siteModel.DropDown.School.SelectedSchool = Convert.ToInt32(hiddenSchoolFilterSearch); return View("Index", siteModel); }
public ActionResult UpdateGrid(string hiddenDistrictFilter, string hiddenSchoolFilter) { int userId = ((SiteUser)Session["SiteUser"]).EdsUserId; int[] userDistricts = _modelServices.GetDistrictsByUserId(userId).ToArray(); SiteModels viewModel = new SiteModels(); viewModel.Teachers = GetViewData(userDistricts, hiddenDistrictFilter, hiddenSchoolFilter, ""); // Add drop down data viewModel.DropDown = new DropDownData(); viewModel.DropDown.District = new DistrictDropDown(_modelServices.DistrictDropDownDataByUser(userId)); viewModel.DropDown.School = new SchoolDropDown(_modelServices.SchoolDropDownDataByDistrict(new int[] { Convert.ToInt32(hiddenDistrictFilter) })); // Reselect drop downs viewModel.DropDown.District.SelectedDistrict = Convert.ToInt32(hiddenDistrictFilter); viewModel.DropDown.School.SelectedSchool = Convert.ToInt32(hiddenSchoolFilter); return View("Index", viewModel); }