Ejemplo n.º 1
0
        public async Task <bool> SetViewAsync(
            RouteData route, HttpContext context,
            ISearchService searchService, IMemberService memberService,
            string partialUriPattern)
        {
            bool   bHasSet            = false;
            string sViewName          = this.ViewName;
            string sTitle             = this.Title;
            bool   bIsInitView        = false;
            string sController        = string.Empty;
            string sAction            = string.Empty;
            string sContenturipattern = string.Empty;

            ViewDataHelper.GetRouteValues(route, out sController,
                                          out sAction, out sContenturipattern);
            //?? can get and post actions can be differentiated by this parameter
            if (partialUriPattern == string.Empty)
            {
                partialUriPattern = sContenturipattern;
            }
            ViewDataHelper.GetViews(route, context, sController,
                                    out bIsInitView, ref sViewName, ref sTitle);
            this.ViewName = sViewName;
            this.Title    = sTitle;
            bHasSet       = await SetSearchModel(context, sController, sAction, bIsInitView,
                                                 partialUriPattern, searchService, memberService);

            bool bIsNetworkingSearch = IsNetworkingSearch();

            bHasSet = await SetSearchDataForAllUsers(context, sController, searchService,
                                                     bIsNetworkingSearch);

            if (!HtmlMemberExtensions.UserIsLoggedIn(context))
            {
                bHasSet = await SetSearchDataForPublicMember(searchService,
                                                             bIsNetworkingSearch);
            }
            else
            {
                bHasSet = await SetSearchDataForLoggedinMember(searchService,
                                                               bIsNetworkingSearch);
            }
            //set the restful addresses
            DataHelpers.SetFullURIs(this.SearchManagerData.SearchResult);
            //publish error messages
            AppHelper.PublishErrorMessage(this.SearchManagerData.SearchResult);
            return(bHasSet);
        }