Exemple #1
0
        public ActionResult Update(string id, string process)
        {
            var    appWrapper = new ServiceAppWrapper(this._restFactory);
            string result     = string.Empty;

            switch (process)
            {
            case "Start":
                appWrapper.Start(id);
                result = appWrapper.IsValid ? "successStart" : "error";
                break;

            case "Stop":
                appWrapper.Stop(id);
                result = appWrapper.IsValid ? "successStop" : "error";
                break;

            case "Run":
                appWrapper.Run(id);
                result = appWrapper.IsValid ? "successRun" : "error";
                break;
            }

            // TODO: log any exceptions to elmah
            return(new RedirectResult(Url.Action("Index") + "#" + result));
        }
Exemple #2
0
        /// <summary>
        /// The Get action for the index.
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var appWrapper = new ServiceAppWrapper(this._restFactory).LoadServiceApps();

            if (appWrapper.IsValid)
            {
                return(View(appWrapper.ServiceAppList));
            }
            else
            {
                this.AddError(appWrapper.ExceptionItem.Item2);
                return(View("Error"));
            }
        }