public IActionResult Dashboard() { ViewBag.text = "Dashboard"; ViewBag.StudioName = _studioDataAccess.GetStudioInfo(GetCurrentStudioId()).Name; DashboardNeeds dashboardNeeds = new DashboardNeeds(); var allClasses = _classDataAccess.GetAllClasses(GetCurrentStudioId()); var allStudents = _studentDataAccess.GetAllStudents(GetCurrentStudioId()); var allInstructors = _instructorDataAccess.GetAllInstructors(GetCurrentStudioId()); foreach (var _class in allClasses) { var classShedule = _classDataAccess.GetClassShedule(_class.Id); foreach (var s in classShedule) { if (s.Day == DateTime.Now.DayOfWeek.ToString() && _class.StartDay <= DateTime.Now) { _class.Hour = s.Hour; dashboardNeeds.classesForToday.Add(_class); } } } foreach (var st in allStudents) { var sL = new SelectListItem() { Value = st.Id.ToString(), Text = $"{st.Firstname} {st.Lastname}" }; dashboardNeeds.AllStudents.Add(sL); } foreach (var ins in allInstructors) { var iL = new SelectListItem() { Value = ins.Id.ToString(), Text = $"{ins.Firstname} {ins.Lastname}" }; dashboardNeeds.AllInstructors.Add(iL); } return(View(dashboardNeeds)); }
public IActionResult RemoveClass(DashboardNeeds dashboardNeeds) { _classDataAccess.RemoveClass(dashboardNeeds.ClassId); return(RedirectToAction("Dashboard")); }