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


C# MvcContext.PostInt方法代码示例

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


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

示例1: 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

示例2: 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

示例3: ValidateCategory

        public static ForumCategory ValidateCategory( ForumCategory category, MvcContext ctx )
        {
            if (category == null) category = new ForumCategory();

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

            String nameColor = ctx.Post( "NameColor" );
            if (strUtil.HasText( nameColor )) {
                String errorInfo = alang( ctx, "exColorFormat" );
                if (nameColor.Length != 7) ctx.errors.Add( errorInfo );
                if (nameColor.StartsWith( "#" ) == false) ctx.errors.Add( errorInfo );
            }

            int boardId = ctx.PostInt( "BoardId" );

            category.Name = name;
            category.NameColor = nameColor;
            category.BoardId = boardId;
            category.OwnerId = ctx.owner.Id;
            category.OwnerType = ctx.owner.obj.GetType().FullName;
            category.Creator = (User)ctx.viewer.obj;

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

示例4: SetSectionValueAndValidate

        public static ContentSection SetSectionValueAndValidate( int layoutId, MvcContext ctx )
        {
            ContentSection section = new ContentSection();
            section.AppId = ctx.app.Id;

            String layoutStr = layoutId.ToString();

            int rowId = cvt.ToInt( layoutStr.Substring( 0, layoutStr.Length - 1 ) );
            int columnId = cvt.ToInt( layoutStr.Substring( layoutStr.Length - 1, 1 ) );

            section.RowId = rowId;
            section.ColumnId = columnId;
            if (ctx.PostInt( "serviceType" ) == 0) {
                int serviceId = ctx.PostInt( "serviceId" );
                section.ServiceId = serviceId;
                section.TemplateId = ctx.PostInt( "templateId" );
            }
            section.SectionType = ctx.Post( "SectionType" );
            validateSectionPrivate( section, ctx );
            return section;
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:21,代码来源:ContentValidator.cs

示例5: Validate

        public static ContentPost Validate( ContentSection section, MvcContext ctx )
        {
            ContentPost post = new ContentPost();
            post.Creator = (User)ctx.viewer.obj;
            post.CreatorUrl = ctx.viewer.obj.Url;
            post.OwnerId = ctx.owner.Id;
            post.OwnerUrl = ctx.owner.obj.Url;
            post.OwnerType = ctx.owner.obj.GetType().FullName;
            post.AppId = section.AppId;
            post.PageSection = section;
            post.CategoryId = ctx.GetInt( "categoryId" );

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

            ValidateEdit( post, ctx );

            if (strUtil.IsNullOrEmpty( post.Title )) post.Title = section.Title + " " + DateTime.Now.ToShortDateString();

            return post;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:21,代码来源:ContentValidator.cs

示例6: ProcessFriend

        // 根据邀请码注册,需要加为好友
        public static void ProcessFriend( User newRegUser, MvcContext ctx )
        {
            IInviteService inviteService = new InviteService();
            IFriendService friendService = new FriendService();

            int friendId = ctx.PostInt( "friendId" );
            if (friendId <= 0) return;

            String friendCode = ctx.Post( "friendCode" );

            Result result = inviteService.Validate( friendId, friendCode );
            if (result.HasErrors) return;

            friendService.AddInviteFriend( newRegUser, friendId );
        }
开发者ID:ningboliuwei,项目名称:wojilu,代码行数:16,代码来源:RegUtils.cs

示例7: ValidateCategory

        public static BlogCategory ValidateCategory( BlogCategory category, MvcContext ctx )
        {
            String name = ctx.Post( "Name" );
            int orderId = ctx.PostInt( "OrderId" );
            String description = ctx.Post( "Description" );

            if (strUtil.IsNullOrEmpty( name )) ctx.errors.Add( lang.get( "exName" ) );

            if (category == null) category = new BlogCategory();

            category.Name = name;
            category.OrderId = orderId;
            category.Description = description;
            category.OwnerId = ctx.owner.obj.Id;
            category.OwnerUrl = ctx.owner.obj.Url;
            category.AppId = ctx.app.Id;

            return category;
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:19,代码来源:BlogValidator.cs

示例8: 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" );
            }

            if (ctx.viewer != null && ctx.viewer.IsAdministrator()) {

                m.Profile.Description = ctx.PostHtmlAll( "Description" );
                m.Signature = ctx.PostHtmlAll( "Signature" );
            }
            else {

                saveDescriptionAndSignature( m, ctx );
            }
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:44,代码来源:UserProfileController.cs

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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.PostInt( "templateId" );

            if (strUtil.IsNullOrEmpty( section.Title )) {
                ctx.errors.Add( lang.get( "exName" ) );
            }
            else {
                section.Title = strUtil.SubString( section.Title, 50 );
            }
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:13,代码来源:ContentValidator.cs


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