示例#1
0
        // GET: Course/Details/5
        public ActionResult Details(string token, string id)
        {
            string username = AuthLogic.CheckToken(token);

            if (username == "")
            {
                throw new Exception("NotAuthorized");
            }
            ViewData["token"] = token;
            var course = Course.GetCourse(id);

            // cast to Subscribed
            CourseView courseView = CourseView.CastFromCourseModel(course.ModelCourse);

            if (courseView.Author == username)
            {
                ViewData["isAuthor"] = true;
            }
            else
            {
                ViewData["isAuthor"] = false;
            }
            ViewData["courseId"] = id;

            // return the subscribed one!
            return(View(courseView));
        }