public HttpStatusCode AddRule(GatewayViewModel inputData)
        {
            //GatewayViewModel inputData = (GatewayViewModel)TempData["ipData"];
            inputData.operation = Operations.AddRule.ToString();

            var result = ApiOperations.ExecutivePutApi(_apiHostedUrl, inputData);

            if (result == HttpStatusCode.OK)
            {
                _resultset.Add(new Resultcs()
                {
                    Message = "Rule created successfully", Status = "Completed", State = true
                });
                return(HttpStatusCode.OK);
            }
            else
            {
                _resultset.Add(new Resultcs()
                {
                    Message = "Unable to create Rule", Status = "Error", State = false
                });
            }

            return(HttpStatusCode.BadRequest);
        }
        public HttpStatusCode AddAddHttpSettings(GatewayViewModel inputData)
        {
            //var inputData = (GatewayViewModel)TempData["ipData"];

            if (TempData["myData"] != null)
            {
                _resultset = TempData["myData"] as List <Resultcs>;
            }

            TempData.Keep();

            inputData.operation = Operations.AddHTTPSettings.ToString();
            var result = ApiOperations.ExecutivePutApi(_apiHostedUrl, inputData);


            if (result == HttpStatusCode.OK)
            {
                _resultset.Add(new Resultcs()
                {
                    Message = "HttpSettings created successfully", Status = "Completed", State = true
                });
                //RedirectToAction("AddBackendAddressPool", "Gateway");
                return(AddBackendAddressPool(inputData));
            }
            else
            {
                _resultset.Add(new Resultcs()
                {
                    Message = "Failed to create HttpSettings", Status = "Error", State = false
                });
                _resultset.Add(new Resultcs()
                {
                    Message = "Unable to create BackendAddressPool", Status = "Not Performed", State = false
                });
                _resultset.Add(new Resultcs()
                {
                    Message = "Unable to create Rule", Status = "Not Performed", State = false
                });
            }
            return(HttpStatusCode.BadRequest);
        }
        public ActionResult AddProbe(UserInputModel inputData)
        {
            GatewayViewModel apiInputData = new GatewayViewModel();

            apiInputData.operation              = Operations.CreateProbe.ToString();
            apiInputData.SubscriptionId         = Constant.subscriptionId;
            apiInputData.ResourceGroupName      = Constant.resourceGroupName;
            apiInputData.ApplicationGatewayName = Constant.applicationGatewayName;

            apiInputData.ProbeName = inputData.FIName + "CustomHealthProbe";
            apiInputData.Protocol  = inputData.Protocol;

            apiInputData.Host      = inputData.Host;
            apiInputData.Probepath = inputData.Probepath;

            apiInputData.HttpSettingsName = inputData.FIName + "AppGatewayHTTPSettings";
            apiInputData.HttpSettingsPort = inputData.Port;


            apiInputData.BckendPoolName  = inputData.FIName + "AppGWBackendpool";
            apiInputData.BckendipAddress = inputData.Host;

            apiInputData.RuleName = inputData.FIName;
            apiInputData.RulePath = inputData.RulePath;

            apiInputData.brearerToken = inputData.BrearerToken;

            var result = ApiOperations.ExecutivePutApi(_apiHostedUrl, apiInputData);

            if (result == HttpStatusCode.OK)
            {
                _resultset.Add(new Resultcs()
                {
                    Message = "Probe created successfully", Status = "Completed", State = true
                });
                AddAddHttpSettings(apiInputData);
            }
            else
            {
                _resultset.Add(new Resultcs()
                {
                    Message = "Failed to create Probe", Status = "Error", State = false
                });
                _resultset.Add(new Resultcs()
                {
                    Message = "Unable to create HttpSettings", Status = "Not Performed", State = false
                });
                _resultset.Add(new Resultcs()
                {
                    Message = "Unable to create BackendAddressPool", Status = "Not Performed", State = false
                });
                _resultset.Add(new Resultcs()
                {
                    Message = "Unable to create Rule", Status = "Not Performed", State = false
                });
            }

            TempData.Put("Result", _resultset);

            return(RedirectToAction("SendResult"));
        }