Ejemplo n.º 1
0
        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 DivideByZeroException("The current user is not authorized to perform this operation.");
            }

            ICourse course = this.GetCourse(courseId);

            course.AddLecture(new Lecture("lectureName"));

            return(this.View(course));
        }