Carrotware.CMS.Mvc.UI.Admin.Models.ModuleInfo.LoadContext C# (CSharp) Method

LoadContext() public method

public LoadContext ( System.Web.Mvc.ViewContext viewContext ) : void
viewContext System.Web.Mvc.ViewContext
return void
        public void LoadContext(ViewContext viewContext)
        {
            this.RouteValues = viewContext.RouteData.Values;

            if (this.RouteValues["action"] != null) {
                this.CurrentAction = this.RouteValues["action"].ToString();
            }
            if (this.RouteValues["controller"] != null) {
                this.CurrentController = this.RouteValues["controller"].ToString();
            }

            this.CurrentActionFull = String.Format("{0}", this.CurrentAction);

            string currentQueryString = String.Empty;
            var request = HttpContext.Current.Request;

            if (request.ServerVariables["QUERY_STRING"] != null) {
                currentQueryString = request.ServerVariables["QUERY_STRING"].ToString();
                if (!String.IsNullOrEmpty(currentQueryString)) {
                    this.CurrentActionFull = String.Format("{0}?{1}", this.CurrentAction, currentQueryString);
                }
            }
        }