Esempio n. 1
0
        // <teamName>
        public override string Execute(TeamBuilderContext context)
        {
            base.MustBeLoggedIn();
            base.CmdArgsExactLengthValidation(ArgsExactLength);

            var teamName = this.CmdArgs[0];
            var team     = this.GetTeam(context, teamName);

            context.Remove(team);
            context.SaveChanges();

            return(string.Format(Success, teamName));
        }
Esempio n. 2
0
        // <teamName> <username>
        public override string Execute(TeamBuilderContext context)
        {
            base.MustBeLoggedIn();
            base.CmdArgsExactLengthValidation(ArgsExactLength);

            var username = this.CmdArgs[1];
            var teamName = this.CmdArgs[0];

            if (this.Session.User.Username.Equals(username, StringComparison.OrdinalIgnoreCase))
            {
                throw new InvalidOperationException(NotAllowedExistExceptionMessage);
            }

            var user = this.AssureUserExists(context, username);
            var team = this.GetTeam(context, teamName, user);

            var mapping = team.TeamUsers.First();

            context.Remove(mapping);
            context.SaveChanges();

            return(string.Format(Success, username, teamName));
        }