コード例 #1
0
 public static void GetRouteValues(Microsoft.AspNetCore.Routing.RouteData route, out string controller,
                                   out string action, out string partialUriPattern)
 {
     controller = (route.Values[CONTROLLER] != null) ?
                  route.Values[CONTROLLER].ToString() : DataHelpers.GetDefaultNetworkGroupName();
     action = (route.Values[ACTION] != null) ?
              route.Values[ACTION].ToString() : DataHelpers.SERVER_ACTION_TYPES.search.ToString();
     partialUriPattern = (route.Values[CONTENTURIPATTERN] != null) ?
                         route.Values[CONTENTURIPATTERN].ToString() : DataHelpers.MakeURIPatternStart();
 }
コード例 #2
0
        //[HttpPost]
        public async Task <ActionResult> LinkedViews(string contenturipattern)
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ? DataHelpers.MakeURIPatternStart()
                : contenturipattern;
            DataHelpers.SERVER_ACTION_TYPES eServerActionType
                = DataHelpers.SERVER_ACTION_TYPES.linkedviews;
            ViewDataHelper viewHelper = new ViewDataHelper();

            viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
            return(await this.GeneralAction(contenturipattern, eServerActionType));
        }
コード例 #3
0
        public async Task <ActionResult> Search(string contenturipattern)
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ?
                                DataHelpers.MakeURIPatternStart() : contenturipattern;
            //check for redirections from ajax content requests or subserveractiontypes
            DataHelpers.SERVER_ACTION_TYPES eServerActionType
                = DataHelpers.SERVER_ACTION_TYPES.search;
            ViewDataHelper viewHelper = new ViewDataHelper();

            viewHelper.GetNewAction(this.HttpContext, ref eServerActionType);
            return(await this.GeneralAction(contenturipattern, eServerActionType));
        }
コード例 #4
0
        //[ChildActionOnly]
        public async Task <ActionResult> ContentAction(string contenturipattern = "")
        {
            contenturipattern = (string.IsNullOrEmpty(contenturipattern)) ?
                                DataHelpers.MakeURIPatternStart() : contenturipattern;
            string sViewName = ViewDataHelper.CONTENT_VIEW;
            string sTitle    = string.Empty;

            ViewData["NetworkGroup"] = AG_TREKS;
            //construct the viewdata model
            ContentViewModel vwContentViewModel = new ContentViewModel(_uri);

            try
            {
                //agtreks shares the same actions as other networkgroups (i.e. buildtreks),
                //so a contentviewdata class is used by all
                bool bHasSet = await vwContentViewModel.SetViewAsync(this.RouteData, this.Request.HttpContext,
                                                                     _contentService, _memberService, contenturipattern);

                sViewName         = vwContentViewModel.ViewName;
                sTitle            = vwContentViewModel.Title;
                ViewData["Title"] = sTitle;
                ViewData["URI"]   = vwContentViewModel.ContentURIData.URIFull ?? string.Empty;
                //return the model to the view
                if (sViewName == ViewDataHelper.MESSAGE_VIEW)
                {
                    //respond with the message
                    ViewData[ViewDataHelper.MESSAGE_VIEW] = vwContentViewModel.ContentURIData.Message;
                    return(View(sViewName));
                }
                else if (sViewName == ViewDataHelper.ERROR_VIEW)
                {
                    //respond with the error message
                    ViewData[ViewDataHelper.ERROR_VIEW] = vwContentViewModel.ContentURIData.ErrorMessage;
                    return(View(sViewName));
                }
                else if (sViewName == ViewDataHelper.JSON_VIEW)
                {
                    //respond with the javascript
                    return(Json(vwContentViewModel.ContentURIData.Json));
                }
                //respond with the model
                return(View(sViewName, vwContentViewModel));
            }
            catch (Exception x)
            {
                AppHelper.SetErrorMessage(x, vwContentViewModel.ContentURIData);
                _logger.LogError(x.Message);
                return(View(sViewName, vwContentViewModel));
            }
        }