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


C# MvcContext.PostHtml方法代码示例

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


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

示例1: SetPostValue

        public static ContentPost SetPostValue( ContentPost post, MvcContext ctx ) {

            post.Author = strUtil.CutString( ctx.Post( "Author" ), 100 );
            post.Title = strUtil.CutString( ctx.Post( "Title" ), 100 );
            post.TitleHome = strUtil.CutString( ctx.Post( "TitleHome" ), 100 );
            post.Content = ctx.PostHtml( "Content" );
            post.Summary = ctx.Post( "Summary" );
            post.SourceLink = strUtil.CutString( ctx.Post( "SourceLink" ), 250 );
            post.AccessStatus = cvt.ToInt( ctx.Post( "AccessStatus" ) );
            post.CommentCondition = cvt.ToInt( ctx.Post( "IsCloseComment" ) );

            post.Hits = ctx.PostInt( "Hits" );
            post.Created = ctx.PostTime( "Created" );

            post.MetaKeywords = strUtil.CutString( ctx.Post( "MetaKeywords" ), 250 );
            post.MetaDescription = strUtil.CutString( ctx.Post( "MetaDescription" ), 250 );
            post.RedirectUrl = strUtil.CutString( ctx.Post( "RedirectUrl" ), 250 );
            post.PickStatus = ctx.PostInt( "PickStatus" );

            post.SaveStatus = 0;
            post.Ip = ctx.Ip;
            post.Style = strUtil.CutString( ctx.Post( "Style" ), 250 );
            post.OrderId = ctx.PostInt( "OrderId" );

            post.ImgLink = sys.Path.GetPhotoRelative( ctx.Post( "ImgLink" ) );

            post.Width = ctx.PostInt( "Width" );
            post.Height = ctx.PostInt( "Height" );

            return post;
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:31,代码来源:ContentValidator.cs

示例2: ValidateBoard

        public static ForumBoard ValidateBoard( ForumBoard board, MvcContext ctx )
        {
            if (board == null) board = new ForumBoard();

            String name = ctx.Post( "Name" );
            if (strUtil.IsNullOrEmpty( name )) {
                ctx.errors.Add( lang.get( "exName" ) );
            }

            String description = ctx.Post( "Description" );
            int parentId = ctx.PostInt( "ParentId" );
            String notice = ctx.PostHtml( "Notice" );

            board.ParentId = parentId;
            board.Name = name;
            board.Description = description;
            board.Notice = notice;

            board.AppId = ctx.app.Id;
            board.Creator = (User)ctx.viewer.obj;
            board.CreatorUrl = ctx.viewer.obj.Url;
            board.OwnerId = ctx.owner.Id;
            board.OwnerUrl = ctx.owner.obj.Url;
            board.OwnerType = ctx.owner.obj.GetType().FullName;
            board.Ip = ctx.Ip;

            board.IsCategory = ctx.PostInt( "IsCategory" );
            board.ViewId = ctx.PostInt( "ViewId" );

            return board;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:31,代码来源:ForumValidator.cs

示例3: saveDescriptionAndSignature

        private static void saveDescriptionAndSignature( User m, MvcContext ctx )
        {
            Dictionary<String, String> tags = new Dictionary<String, String>();
            tags.Add( "a", "href,target" );
            tags.Add( "br", "" );
            tags.Add( "strong", "" );

            String desc = ctx.PostHtml( "Description", tags );

            if (strUtil.CountString( desc.ToLower(), "<br" ) <= 3) { // 超过3次换行无效,不保存

                if (desc.Length >= config.Instance.Site.UserDescriptionMin) {
                    if (desc.Length > config.Instance.Site.UserDescriptionMax) {
                        m.Profile.Description = strUtil.ParseHtml( desc, config.Instance.Site.UserDescriptionMax );
                    }
                    else {
                        m.Profile.Description = desc;
                    }
                }

            }

            String sign = ctx.PostHtml( "Signature", tags );

            if (strUtil.CountString( sign.ToLower(), "<br" ) <= 3) { // 超过3次换行无效,不保存

                if (sign.Length >= config.Instance.Site.UserSignatureMin) {
                    if (sign.Length > config.Instance.Site.UserSignatureMax) {
                        m.Signature = strUtil.ParseHtml( sign, config.Instance.Site.UserSignatureMax );
                    }
                    else {
                        m.Signature = sign;
                    }
                }

            }
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:37,代码来源:UserProfileController.cs

示例4: SaveProfile

        internal static void SaveProfile( User m, MvcContext ctx )
        {
            m.RealName = ctx.Post( "Name" );
            m.Title = strUtil.SubString( ctx.Post( "Title" ), 20 );

            m.Gender = ctx.PostInt( "Gender" );
            m.Blood = ctx.PostInt( "Blood" );
            m.Degree = ctx.PostInt( "Degree" );
            m.Relationship = ctx.PostInt( "Relationship" );
            m.Zodiac = ctx.PostInt( "Zodiac" );

            m.BirthYear = ctx.PostInt( "Year" );
            m.BirthMonth = ctx.PostInt( "Month" );
            m.BirthDay = ctx.PostInt( "Day" );

            m.ProvinceId1 = ctx.PostInt( "ProvinceId1" );
            m.ProvinceId2 = ctx.PostInt( "ProvinceId2" );
            m.City1 = ctx.Post( "City1" );
            m.City2 = ctx.Post( "City2" );

            m.Profile.Purpose = ctx.Post( "Purpose" );
            m.Profile.ContactCondition = ctx.PostInt( "ContactCondition" );

            if (config.Instance.Site.ShowSexyInfoInProfile) {
                m.Profile.Sexuality = ctx.PostInt( "Sexuality" );
                m.Profile.Smoking = ctx.PostInt( "Smoking" );
                m.Profile.Sleeping = ctx.PostInt( "Sleeping" );
                m.Profile.Body = ctx.PostInt( "Body" );
                m.Profile.Hair = ctx.PostInt( "Hair" );
                m.Profile.Height = ctx.PostInt( "Height" );
                m.Profile.Weight = ctx.PostInt( "Weight" );
                m.Profile.OtherInfo = ctx.Post( "OtherInfo" );
            }

            int descMaxLength = 5000; // ������5000��
            int sigMaxLength = 1000; // ǩ�����1000��

            m.Profile.Description = ctx.PostHtml( "Description", "a,br,strong" );
            if (m.Profile.Description.Length > descMaxLength) m.Profile.Description = strUtil.ParseHtml( m.Profile.Description, descMaxLength );

            m.Signature = ctx.PostHtml( "Signature", "a,br,strong" );
            if (m.Signature.Length > sigMaxLength) m.Signature = strUtil.ParseHtml( m.Signature, sigMaxLength );
        }
开发者ID:robin88,项目名称:wojilu,代码行数:43,代码来源:UserProfileController.cs

示例5: ValidateTopicEdit

        public static ForumTopic ValidateTopicEdit( ForumTopic topic, MvcContext ctx )
        {
            if (topic == null) topic = new ForumTopic();

            String title = ctx.Post( "Title" );
            String content = ctx.PostHtml( "Content" );

            if (strUtil.IsNullOrEmpty( title )) ctx.errors.Add( lang.get( "exTitle" ) );
            if (strUtil.IsNullOrEmpty( content )) ctx.errors.Add( lang.get( "exContent" ) );

            topic.Title = title;
            topic.Content = content;
            topic.Category = new ForumCategory( ctx.PostInt( "CategoryId" ) );
            topic.TagRawString = ctx.Post( "TagList" );

            return topic;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:17,代码来源:ForumValidator.cs

示例6: ValidateTopic

        public static ForumTopic ValidateTopic( ForumTopic topic, MvcContext ctx )
        {
            if (topic == null) topic = new ForumTopic();

            String title = ctx.Post( "Title" );
            String content = ctx.PostHtml( "Content" );

            if (strUtil.IsNullOrEmpty( title )) ctx.errors.Add( lang.get( "exTitle" ) );
            if (strUtil.IsNullOrEmpty( content )) ctx.errors.Add( lang.get( "exContent" ) );

            topic.Title = title;
            topic.Content = content;
            topic.Category = new ForumCategory( ctx.PostInt( "CategoryId" ) );
            topic.Reward = ctx.PostInt( "Reward" );
            topic.RewardAvailable = topic.Reward;
            topic.ReadPermission = ctx.PostInt( "ReadPermission" );
            topic.Price = ctx.PostInt( "Price" );
            topic.TagRawString = ctx.Post( "TagList" );

            topic.IsAttachmentLogin = ctx.PostIsCheck( "IsAttachmentLogin" );

            return topic;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:23,代码来源:ForumValidator.cs

示例7: ValidatePostEdit

        public static ForumPost ValidatePostEdit( ForumPost post, MvcContext ctx )
        {
            String title = ctx.Post( "Title" );
            String content = ctx.PostHtml( "Content" );

            if (strUtil.IsNullOrEmpty( title )) ctx.errors.Add( lang.get( "exTitle" ) );
            if (strUtil.IsNullOrEmpty( content )) ctx.errors.Add( lang.get( "exContent" ) );

            post.Title = title;
            post.Content = content;

            return post;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:13,代码来源:ForumValidator.cs

示例8: ValidatePost

        public static ForumPost ValidatePost( MvcContext ctx )
        {
            ForumPost post = new ForumPost();
            int boardId = ctx.PostInt( "forumId" );
            int topicId = ctx.PostInt( "topicId" );
            int parentId = ctx.PostInt( "parentId" );
            String title = ctx.Post( "Title" );
            String content = ctx.PostHtml( "Content" );

            if (boardId <= 0) {
                ctx.errors.Add( alang( ctx, "exBoardSet" ) );
            }
            else {
                post.ForumBoardId = boardId;
            }

            if (topicId <= 0) {
                ctx.errors.Add( ctx.controller.alang( "exTopicNotFound" ) );
            }
            else {
                ForumTopic topic = ForumTopic.findById( topicId );
                if (topic == null) {
                    ctx.errors.Add( ctx.controller.alang( "exTopicNotFound" ) );
                }
                else {
                    post.Topic = topic;
                }
            }

            if (strUtil.IsNullOrEmpty( title )) ctx.errors.Add( lang.get( "exTitle" ) );
            if (strUtil.IsNullOrEmpty( content )) ctx.errors.Add( lang.get( "exContent" ) );

            post.ForumBoardId = boardId;
            post.TopicId = topicId;
            post.ParentId = parentId;
            post.Title = title;
            post.Content = content;
            post.Ip = ctx.Ip;

            return post;
        }
开发者ID:robin88,项目名称:wojilu,代码行数:41,代码来源:ForumValidator.cs

示例9: validateSectionPrivate

        private static void validateSectionPrivate( ContentSection section, MvcContext ctx ) {
            section.Title = ctx.Post( "Title" );
            section.MoreLink = strUtil.CutString( ctx.PostHtml( "MoreLink" ), 250 );
            section.TemplateId = ctx.PostLong( "templateId" );

            if (strUtil.IsNullOrEmpty( section.Title )) {
                ctx.errors.Add( lang.get( "exName" ) );
            }
            else {
                section.Title = strUtil.SubString( section.Title, 50 );
            }

        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:13,代码来源:ContentValidator.cs


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