Example #1
0
        public IView Register(string username, string password, string confirmPassword, string role)
        {
            if (password != confirmPassword)
            {
                throw new ArgumentException("The provided passwords do not match.");
            }

            this.EnsureNoLoggedInUser();

            var existingUser = this.Data.Users.GetByUsername(username);
            if (existingUser != null)
            {
                throw new ArgumentException(string.Format("A user with username {0} already exists.", username));
            }

            Role userRole = (Role)Enum.Parse(typeof(Role), role, true);
            var user = new User(username, password, userRole);
            this.Data.Users.Add(user);
            return this.View(user);
        }
Example #2
0
 public CoursesController(IBangaloreUniversityDate data, User user)
 {
     this.Data = data;
     this.User = user;
 }
Example #3
0
 public Logout(User user)
     : base(user)
 {
 }
Example #4
0
 public void AddStudent(User student)
 {
     this.Students.Add(student);
     student.Courses.Add(this);
 }
Example #5
0
 public Register(User user)
     : base(user)
 {
 }
Example #6
0
 public Login(User user)
     : base(user)
 {
 }