当前位置: 首页>>代码示例>>C#>>正文


C# MvcContext.GetItem方法代码示例

本文整理汇总了C#中MvcContext.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# MvcContext.GetItem方法的具体用法?C# MvcContext.GetItem怎么用?C# MvcContext.GetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MvcContext的用法示例。


在下文中一共展示了MvcContext.GetItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToApp

        /// <summary>
        /// ����Ч��������׺�������� /Forum1/Forum/Index.aspx
        /// </summary>
        /// <param name="app"></param>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public static String ToApp( IApp app, MvcContext ctx )
        {
            if (ctx.IsMock && ctx.GetItem( "_makeHtml" ) != null) return HtmlLink.ToApp( app );

            String appName = strUtil.TrimEnd( app.GetType().Name, "App" );
            return getAppLink( app.OwnerType, app.OwnerUrl, appName, app.Id );
        }
开发者ID:jilumvc,项目名称:Sajoo,代码行数:13,代码来源:alink.cs

示例2: ToAppData

        public static String ToAppData( IAppData data, MvcContext ctx )
        {
            if (ctx != null && ctx.IsMock && ctx.GetItem( "_makeHtml" ) != null) return HtmlLink.ToAppData( data );

            String controllerPath = getAppDataController( data.GetType().FullName, data.AppId );

            return To( data, controllerPath, "Show", data.Id );
        }
开发者ID:jilumvc,项目名称:Sajoo,代码行数:8,代码来源:alink.cs

示例3: GetCacheKey

        public string GetCacheKey( MvcContext ctx, string actionName ) {

            IMember owner = ctx.owner.obj;
            int appId = ctx.app.Id;
            int boardId = (int)ctx.GetItem( "boardId" ); // TODO
            int pageId = 1;// TODO 多个分页依次更新

            return owner.GetType().FullName + "_" + owner.Url.Replace( "/", "" ) + "_" + typeof( wojilu.Web.Controller.Forum.BoardController ).FullName + "_app" + appId + "_board" + boardId + "_p" + pageId;
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:9,代码来源:ForumBoardFilter.cs

示例4: ToApp

        /// <summary>
        /// 获取App的网址。最后的效果包括后缀名,比如 /Forum1/Forum/Index.aspx
        /// </summary>
        /// <param name="app"></param>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public static String ToApp( IApp app, MvcContext ctx )
        {
            if (ctx != null && ctx.IsMock && ctx.GetItem( "_makeHtml" ) != null) return HtmlLink.ToApp( app );

            String appName = strUtil.TrimEnd( app.GetType().Name, "App" );
            String ret = getAppLink( app.OwnerType, app.OwnerUrl, appName, app.Id );
            if (MvcConfig.Instance.IsUrlToLower) {
                return ret.ToLower();
            }
            return ret;
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:17,代码来源:alink.cs

示例5: GetViewById

        public String GetViewById( int pollId, String typeFullName, MvcContext ctx )
        {
            User viewer = ctx.viewer.obj as User;

            int sectionId = (int)ctx.GetItem( "sectionId" );

            PollBase poll = getByTopic( pollId );
            if (poll == null) throw new NullReferenceException( lang.get( "exPollNotFound" ) );
            String lnkVote = ctx.GetLink().To( new wojilu.Web.Controller.Content.Section.PollController().Vote, poll.Id ) + "?sectionId=" + sectionId;
            String lnkVoter = ctx.GetLink().To( new wojilu.Web.Controller.Content.Section.PollController().Voter, poll.Id ) + "?sectionId=" + sectionId;

            return new PollViewFactory( viewer, poll, lnkVote, lnkVoter ) .GetPollView().GetBody( false );
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:13,代码来源:ContentPollExtViewService.cs

示例6: AfterAction

        public override void AfterAction( MvcContext ctx )
        {
            if ((ctx.owner.obj is Site) == false) return;

            // 1) board
            int boardId = getBoardId( ctx );
            updateOneBoard( ctx, boardId );

            // 2) 如果有多个board,比如移动主题的时候(move topic)
            int targetForumId = cvt.ToInt( ctx.GetItem( "targetForumId" ) );
            if (targetForumId >0) {
                updateOneBoard( ctx, targetForumId );
            }
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:14,代码来源:ForumBoardCache.cs

示例7: UpdateCache

        public void UpdateCache( MvcContext ctx ) {

            if ((ctx.owner.obj is Site) == false) return;

            IMember owner = ctx.owner.obj;
            int appId = ctx.app.Id;
            int boardId = (int)ctx.GetItem( "boardId" ); // TODO
            int pageId = 1;// TODO 多个分页依次更新

            String key = GetCacheKey( ctx, null );

            String content = getIndexCache( owner, appId, boardId, pageId );

            CacheManager.GetApplicationCache().Put( key, content );
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:15,代码来源:ForumBoardFilter.cs

示例8: makeHtml

        protected String makeHtml( String addr, List<String> nextMakeUrls ) {
            StringWriter sw = new StringWriter();
            IWebContext webContext = MockWebContext.New( addr, sw );
            MvcContext ctx = new MvcContext( webContext );
            ctx.SetItem( "_makeHtml", true );

            new CoreHandler().ProcessRequest( ctx );

            List<String> relativeUrls = ctx.GetItem( "_relativeUrls" ) as List<String>;
            if (relativeUrls != null && relativeUrls.Count > 0) {
                nextMakeUrls.AddRange( relativeUrls );
            }

            return sw.ToString();
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:15,代码来源:HtmlMaker.cs

示例9: ToApp

        /// <summary>
        /// 获取App的网址。最后的效果包括后缀名,比如 /Forum1/Forum/Index.aspx
        /// </summary>
        /// <param name="app"></param>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public static String ToApp( IApp app, MvcContext ctx )
        {
            // 1) html
            if (ctx != null && ctx.IsMock && ctx.GetItem( "_makeHtml" ) != null) return HtmlLink.ToApp( app );

            String appName = strUtil.TrimEnd( app.GetType().Name, "App" );

            // 2) link map
            String controller = appName + "/" + appName;
            String x = LinkMap.To( app.OwnerType, app.OwnerUrl, controller, "Index", app.Id );
            if (x != null) return x;

            // 3)
            String ret = getAppLink( app.OwnerType, app.OwnerUrl, appName, app.Id );
            if (MvcConfig.Instance.IsUrlToLower) {
                return ret.ToLower();
            }
            return ret;
        }
开发者ID:KDF5000,项目名称:wojilu,代码行数:25,代码来源:alink.cs

示例10: AddUploadUrl

        /// <summary>
        /// ����ͼƬ�ϴ���ַ
        /// </summary>
        /// <param name="ctx"></param>
        public void AddUploadUrl( MvcContext ctx )
        {
            Object objuploadUrl = ctx.GetItem( "editorUploadUrl" );
            Object objmypicsUrl = ctx.GetItem( "editorMyPicsUrl" );

            this.UploadUrl = objuploadUrl == null ? "" : objuploadUrl.ToString();
            this.MyPicsUrl = objmypicsUrl == null ? "" : objmypicsUrl.ToString();
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:12,代码来源:Editor.cs

示例11: ToAppData

        public static String ToAppData( IAppData data, MvcContext ctx )
        {
            if (data == null) return "";

            // 1) html
            if (ctx != null && ctx.IsMock && ctx.GetItem( "_makeHtml" ) != null) return HtmlLink.ToAppData( data );

            String controllerPath = getAppDataController( data.GetType().FullName, data.AppId );

            // 2) link map
            String x = LinkMap.To( data.OwnerType, data.OwnerUrl, controllerPath, "Show", data.Id, data.AppId );
            if (x != null) return x;

            // 3)
            return To( data, controllerPath, "Show", data.Id );
        }
开发者ID:KDF5000,项目名称:wojilu,代码行数:16,代码来源:alink.cs

示例12: getBoardId

        private static int getBoardId( MvcContext ctx )
        {
            int bid = cvt.ToInt( ctx.GetItem( "boardId" ) );
            if (bid > 0) return bid;

            int boardId = ctx.GetInt( "boardId" );
            if (boardId > 0) return boardId;

            if (ctx.route.id > 0) return ctx.route.id;

            return -1;
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:12,代码来源:ForumBoardCache.cs

示例13: IsMakeHtml

 public static Boolean IsMakeHtml( MvcContext ctx ) {
     if (ctx.GetItem( "_makeHtml" ) == null) return false;
     Boolean isMakeHtml = (Boolean)ctx.GetItem( "_makeHtml" );
     return isMakeHtml;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:5,代码来源:HtmlHelper.cs

示例14: GetPostListFromContext

 public static List<ContentPost> GetPostListFromContext( MvcContext ctx ) {
     return ctx.GetItem( "_currentContentPostList" ) as List<ContentPost>;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:3,代码来源:HtmlHelper.cs

示例15: GetPostFromContext

 public static ContentPost GetPostFromContext( MvcContext ctx ) {
     return ctx.GetItem( "_currentContentPost" ) as ContentPost;
 }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:3,代码来源:HtmlHelper.cs


注:本文中的MvcContext.GetItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。