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


C# MvcContext.Post方法代码示例

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


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

        public static String GetTitleStyle( MvcContext ctx )
        {
            String fontStyle = ctx.Post( "fontStyle" );
            String fontColor = ctx.Post( "fontColor" );
            String fontSize = ctx.Post( "fontSize" );
            String fontFamily = ctx.Post( "fontFamily" );

            StringBuilder builder = new StringBuilder();

            if (strUtil.HasText( fontColor )) {
                builder.Append( "color:" );
                builder.Append( fontColor );
                builder.Append( ";" );
            }

            if (strUtil.HasText( fontSize )) {
                builder.Append( "font-size:" );
                builder.Append( fontSize );
                builder.Append( ";" );
            }

            if (strUtil.HasText( fontFamily )) {
                builder.Append( "font-family:" );
                builder.Append( fontFamily );
                builder.Append( ";" );
            }

            if (strUtil.HasText( fontStyle )) {
                builder.Append( fontStyle.Replace( ",", ";" ) );
            }

            return builder.ToString();
        }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:33,代码来源:FormController.cs

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

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

示例6: getMenuStyle

 private static String getMenuStyle( MvcContext ctx )
 {
     String style = "";
     if (ctx.PostIsCheck( "chkBold" ) == 1) style += "font-weight:bold;";
     String menuColor = ctx.Post( "menuColor" );
     if (strUtil.HasText( menuColor )) {
         String mcolor = cvt.ToColorValue( menuColor );
         if (mcolor != null) style += "color:" + mcolor + ";";
     }
     return style;
 }
开发者ID:LeoLcy,项目名称:cnblogsbywojilu,代码行数:11,代码来源:MenuBaseController.cs

示例7: UpdateSettings

 //------------------------------------------------------------------------------------
 public static void UpdateSettings( IList list, MvcContext ctx )
 {
     for (int i = 0; i < list.Count; i++) {
         ISettingValue s = list[i] as ISettingValue;
         String target = ctx.Post( GetInputName( s.Id ) );
         if (strUtil.HasText( target )) {
             if (s.DataType == SettingType.Bool.ToString()) {
                 updateSetting( s, cvt.ToBool( target ).ToString() );
             }
             else if (!(s.DataType == SettingType.Int.ToString()) || cvt.IsInt( target )) {
                 updateSetting( s, target );
             }
         }
     }
 }
开发者ID:bae2014,项目名称:wojilu,代码行数:16,代码来源:SettingFormTool.cs

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

示例9: updateParamValues

 public static void updateParamValues( ContentSection section, IContentSectionService sectionService, MvcContext ctx )
 {
     IList parms = ServiceContext.Get( section.ServiceId ).GetParams();
     int count = parms.Count;
     StringBuilder builder = new StringBuilder();
     for (int i = 0; i < count; i++) {
         ParamControl control = parms[i] as ParamControl;
         builder.Append( "param" );
         builder.Append( i );
         builder.Append( "=" );
         String strVal = ctx.Post( "param" + i );
         object val = control.ChangeType( strVal );
         builder.Append( val );
         if (i < (count - 1)) {
             builder.Append( ";" );
         }
     }
     section.ServiceParams = builder.ToString();
     sectionService.Update( section );
 }
开发者ID:Boshin,项目名称:wojilu,代码行数:20,代码来源:SectionSettingController.cs

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

示例11: getPostValues

        public static Dictionary<String, String> getPostValues( MvcContext ctx )
        {
            Dictionary<String, String> result = new Dictionary<String, String>();

            Dictionary<String, CssControl> cssItems = CssInfo.GetCssItem();
            foreach (KeyValuePair<String, CssControl> kv in cssItems) {

                String val = ctx.Post( kv.Key );
                if (kv.Value == CssControl.Color) {

                    val = getColorValue( val );
                }

                else if (kv.Value == CssControl.Px) {
                    if (strUtil.IsNullOrEmpty( val )) {
                        val = null;
                    }
                    else {

                        val = strUtil.TrimEnd( val, "px" ).Trim();

                        int intVal = cvt.ToInt( val );
                        val = intVal + "px";
                    }

                }
                else if (kv.Value == CssControl.BackgroundUrl) {
                    if (strUtil.HasText( val )) {
                        if (val.StartsWith( "http://" ) == false && val.StartsWith( "/" ) == false) {
                            val = "http://" + val;
                        }
                        val = String.Format( "url({0})", val );
                    }
                }

                result.Add( kv.Key, val );
            }
            return result;
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:39,代码来源:CssFormUtil.cs

示例12: ClientCode

 /// <summary>
 /// 用户实际提交的验证码
 /// </summary>
 /// <param name="ctx"></param>
 /// <returns></returns>
 public String ClientCode( MvcContext ctx )
 {
     return ctx.Post( inputName );
 }
开发者ID:bae2014,项目名称:wojilu,代码行数:9,代码来源:Captcha.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.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

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

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


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