Example #1
0
        public bool OpenDoor(int userId)
        {
            User user = GetUser(userId);

            if (user != null)
            {
                if (doorLock.Open())
                {
                    logs.Add(new Log(DateTime.Now, user, this.DoorStatus()));
                    return(true);
                }
                return(false);
            }
            else
            {
                throw new UnAuthorizeUserException("This user is not authorized to control this door");
            }
        }