コード例 #1
0
        public void AddGuest(User newUser)
        {
            if (newUser == null)
            {
                throw new ArgumentNullException();
            }
            if (UserNameAlreadyExists(newUser.UserName))
            {
                throw new UserAlreadyExistsException();
            }
            if (!(MailAddressIsValid(newUser.MailAddress)))
            {
                throw new NotValidEmailAddressException();
            }
            Guest guest = new Guest()
            {
                UserName         = newUser.UserName,
                Password         = newUser.Password,
                PrivateName      = newUser.PrivateName,
                FamilyName       = newUser.FamilyName,
                Type             = newUser.Type,
                MailAddress      = newUser.MailAddress,
                RegistrationDate = DateTime.Today
            };

            myDal.AddGuest(guest);
        }