public ActionResult Enrollinclass(IndexModel enroll) { var user = (LearningCenter.WebSite.Models.UserModel)Session["User"]; int classId = int.Parse(enroll.classToAdd); enrollmentManager.Add(user.Id, classId); return(RedirectToAction("Studentclasses")); }
public ActionResult ClassEnrollment(TheLearningStore.WebSite.Models.ClassEnrollmentViewModel classEnrollmentViewModel) { var classes = classManager.Classes .Select(t => new TheLearningCenter.WebSite.Models.ClassModel ( t.ClassID, t.ClassName, t.ClassDescription, t.ClassPrice )).ToList(); SelectList listItems = new SelectList(classes, "classId", "className"); ViewBag.classes = listItems; var currentUserId = (TheLearningCenter.WebSite.Models.UserModel)Session["User"]; var selectedClass = int.Parse(Request.Form["classList"]); var Enrolled = enrollmentManager.Add(currentUserId.UserId, selectedClass); return(RedirectToAction("StudentClasses", "Home", Enrolled)); }