Ejemplo n.º 1
0
        public IView AddLecture(int courseId, string lectureName)
        {
            this.EnsureAuthorization(Role.Lecturer);

            Course course = this.CourseGetter(courseId);

            course.AddLecture(new Lecture(lectureName));
            return(this.View(course));
        }
Ejemplo n.º 2
0
        public IView AddLecture(int courseId, string lectureName)
        {
            this.EnsureAuthorization(Role.Lecturer);

            Course course  = this.GetCourseById(courseId);
            var    lecture = new Lecture(lectureName);

            course.AddLecture(lecture);
            return(this.View(course));
        }
Ejemplo n.º 3
0
        public IView AddLecture(int courseId, string lectureName)
        {
            this.ValidateLoggedUser();
            this.ValidatePremissions();

            Course c = this.GetCourseById(courseId);

            c.AddLecture(new Lecture(lectureName));

            return(this.View(c));
        }
Ejemplo n.º 4
0
        public IView AddLecture(int courseId, string lectureName)
        {
            if (!this.HasCurrentUser)
            {
                throw new ArgumentException("There is no currently logged in user.");
            }

            if (!this.usr.IsInRole(Role.Lecturer))
            {
                throw new DivideByZeroException("The current user is not authorized to perform this operation.");
            }

            Course c = courseGetter(courseId);

            c.AddLecture(new Lecture("lectureName"));
            return(View(c));
        }
        public IView AddLecture(int courseId, string lectureName)
        {
            if (!this.HasCurrentUser)
            {
                throw new ArgumentException("There is no currently logged in user.");
            }

            if (!this.User.IsInRole(Role.Lecturer))
            {
                throw new ArgumentException("The current user is not authorized to perform this operation.");
            }

            Course courseById = this.GetCourseById(courseId);

            courseById.AddLecture(new Lecture(lectureName));
            return(this.View(courseById));
        }
        public IView AddLecture(int courseId, string lectureName)
        {
            if (!this.HasCurrentUser)
            {
                throw new ArgumentException("There is no currently logged in user.");
            }

            if (!this.User.IsInRole(Role.Lecturer))
            {
                throw new AuthorizationFailedException();
            }

            Course course = this.GetCourseById(courseId);

            course.AddLecture(new Lecture(lectureName));
            return(this.View(course));
        }
Ejemplo n.º 7
0
        public IView AddLecture(int courseId, string lectureName)
        {
            if (!this.HasCurrentUser)
            {
                throw new ArgumentException("There is no currently logged in user.");
            }

            // Performance: Useless foreach was found.
            if (!this.CurrentUser.IsInRole(Role.Lecturer))
            {
                throw new AuthorizationFailedException("The current user is not authorized to perform this operation.");
            }

            Course course = this.GetCourseById(courseId);

            course.AddLecture(new Lecture(lectureName));
            return(this.View(course));
        }