예제 #1
0
        public Response Post(IisAction action)
        {
            var response = new Response();

            switch (action.Action)
            {
            case "Toggle":

                var buildAppPools = action.Build.Apps.Select(x => x.Pool).ToList();
                _handler.Toggle(buildAppPools);

                response.AddSuccessNotification("Application pools toggled successfully.");
                break;

            case "Whitelist":
                var whitelistProvider = new WhitelistHandler().Provider;
                var isWhitelisted     = whitelistProvider.Toggle(action.Build.Name);
                var function          = isWhitelisted ? "" : "un";

                response.AddSuccessNotification($"Application {function}whitelisted successfully.");
                break;

            case "Note":
                var notes = new NoteHelper();
                notes.Save(action.Build.Name, action.Build.Note);
                response.AddSuccessNotification("Application note saved succesfully.");
                break;
            }

            return(response);
        }