Exemple #1
0
        private HttpResponseMessage GetContent(DESettings settings, DLBase defaultList)
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            string result = string.Empty;

            defaultList.Populate();
            DefaultListModel model = new DefaultListModel(defaultList.DEList);

            model.BackURL    = string.Format(model.BackURL, settings.BusinessUnit);
            result           = ViewRenderer.RenderView("~/Views/SystemDefaults/DefaultList.cshtml", model, null);
            response.Content = new StringContent(result);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
            return(response);
        }
        private HttpResponseMessage GetContent(DESettings settings, DatabaseUpdatesModel model = null, string action = "get")
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            string result = string.Empty;

            if (settings.Module_Name != string.Empty && settings.BusinessUnit != string.Empty)
            {
                if (model == null)
                {
                    model = new DatabaseUpdatesModel(settings);
                }
                result = ViewRenderer.RenderView("~/Views/DatabaseUpdates/DatabaseUpdates.cshtml", model, null);
            }
            response.Content = new StringContent(result);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
            return(response);
        }
        // GET api/SystemDefaultsValues
        public HttpResponseMessage GetValues()
        {
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
            string result = string.Empty;

            // If systemdefaults.aspx is called directly(or missing required querystring parameters) then redirect to the "Module List" paeg
            base.SetParamsAndSettings();
            if ([email protected]("modulename") || [email protected]("businessunit"))
            {
                result = "returnURL=DefaultList.aspx";
            }
            else
            {
                ConfigurationModel model = new ConfigurationModel(settings);
                model.Initialise();
                result = ViewRenderer.RenderView("~/Views/SystemDefaults/Configuration.cshtml", model, null);
            }
            response.Content = new StringContent(result);
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
            return(response);
        }
Exemple #4
0
        public static string RenderView(string viewPath, object model, ControllerContext controllerContext)
        {
            var renderer = new ViewRenderer(controllerContext);

            return(renderer.RenderView(viewPath, model));
        }