//***** ViewTAs ***** public ActionResult ViewTAs(string Id, string prefix, string number, string notification = "") { //Ensures the Professor is still logged in ProfessorModel user = null; if ((user = Cache.GetUser <ProfessorModel>()) == null) { return(RedirectToAction(actionName: "SignOut", controllerName: "Home")); } if (Int32.TryParse(Id, out int id) && !string.IsNullOrWhiteSpace(prefix) && !string.IsNullOrWhiteSpace(number)) { //Creates a generic object containing all important info for 'ChooseTAs' View TAOptions options = new TAOptions() { CourseId = id, CourseName = $"{prefix} {number}", Notifications = notification }; DB.Course course = user.Courses != null?user.Courses.FirstOrDefault(x => x.Id == id) : null; if (course != null && course.TAs != null && course.TAs.Count > 0) { options.TAs = course.TAs.ToList(); } user.Notifications = notification; return(View(options)); } return(RedirectToAction(actionName: "Index", controllerName: "Professor")); }
//***** ChooseTAs ***** public ActionResult ChooseTAs(string Id, string prefix, string number, string notification = "") { //Ensures the Professor is still logged in ProfessorModel user = null; if ((user = Cache.GetUser <ProfessorModel>()) == null) { return(RedirectToAction(actionName: "SignOut", controllerName: "Home")); } if (Int32.TryParse(Id, out int id) && !string.IsNullOrWhiteSpace(prefix) && !string.IsNullOrWhiteSpace(number)) { //Creates a generic object containing all important info for 'ChooseTAs' View TAOptions options = new TAOptions() { CourseId = id, CourseName = $"{prefix} {number}", Notifications = notification }; options.TAs = DB.DBMethods.TAs_GetUnassigned($"{prefix} {number}"); user.Notifications = notification; return(View(options)); } return(RedirectToAction(actionName: "Index", controllerName: "Professor")); }