コード例 #1
0
        public void ChangeCurrentTown()
        {
            ModifyUserValidator.TownNotFound(this.NewValue);
            ChangeTownID();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(string.Format(ModifyMessage.Success, this.Username, this.Property, this.NewValue));
        }
コード例 #2
0
        // ModifyUser <username> <property> <new value>
        // For example:
        // ModifyUser <username> Password <NewPassword>
        // ModifyUser <username> BornTown <newBornTownName>
        // ModifyUser <username> CurrentTown <newCurrentTownName>
        // !!! Cannot change username
        public void Parse(string[] commandData)
        {
            ModifyUserValidator.InvalidParameters(commandData.Length);

            this.Username = commandData[1];
            this.Property = commandData[2];
            this.NewValue = commandData[3];
        }
コード例 #3
0
        public void Execute()
        {
            ModifyUserValidator.UserNotFound(this.Username);
            ModifyUserValidator.PropertyNotFound(this.Property);

            var exeMethods = typeof(ModifyUserCommand).GetMethods()
                             .SingleOrDefault(m => m.Name.ToLower().Contains(this.Property.ToLower()))
                             .Invoke(new ModifyUserCommand(), new object[] { });
        }
コード例 #4
0
        public void ChangePassword()
        {
            ModifyUserValidator.InvalidPassword(this.NewValue);

            context.Users.SingleOrDefault(u => u.Username == this.Username).Password = this.NewValue;
            context.SaveChanges();

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine(string.Format(ModifyMessage.Success, this.Username, this.Property, this.NewValue));
        }