public ActionResult StudentClasses() { ViewBag.Message = "Student Class Listing."; var user = (Models.UserModel)Session["User"]; var classes = classManager.StudentClasses(user.Id) .Select(c => new Models.ClassModel(c.Id, c.Name, c.Description, c.Price)) .ToArray(); return(View(classes)); }
public ActionResult StudentClasses() { if (Session["User"] != null) { var user = Session["User"] as FinalProject.Models.UserModel; var studentClasses = classManager.StudentClasses(user.UserId); return(View(studentClasses)); } else { return(RedirectToAction("Login")); } }