public ActionResult RespondToApplication(int id = 0) { var userManager = LMSRepo.GetUserManager(); var application = LMSRepo.GetCourseApplicationID(id); var student = userManager.FindById(application.Student.Id); var model = new Course_ApplicationViewModel { CourseID = application.Course.ID, CourseName = application.Course.CourseName, Message = application.Message, StudentRealName = application.Student.RealName }; return(View(model)); }
public ActionResult Apply(int id = 0) { var userManager = LMSRepo.GetUserManager(); var course = LMSRepo.GetCourseByID(id); var student = userManager.FindById(User.Identity.GetUserId()); var model = new Course_ApplicationViewModel { CourseID = course.ID, CourseName = course.CourseName, }; //If the student is already enrolled in a course if (course.Students.Contains(student)) { return(View("_ApplicationForbidden")); } return(View(model)); }