本文整理汇总了C#中MvcContext.PostLong方法的典型用法代码示例。如果您正苦于以下问题:C# MvcContext.PostLong方法的具体用法?C# MvcContext.PostLong怎么用?C# MvcContext.PostLong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MvcContext
的用法示例。
在下文中一共展示了MvcContext.PostLong方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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" );
long parentId = ctx.PostLong( "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.PostLong( "ViewId" );
return board;
}
示例2: ProcessFriend
// 根据邀请码注册,需要加为好友
public static void ProcessFriend( User newRegUser, MvcContext ctx ) {
IInviteService inviteService = new InviteService();
IFriendService friendService = new FriendService();
long friendId = ctx.PostLong( "friendId" );
if (friendId <= 0) return;
String friendCode = ctx.Post( "friendCode" );
Result result = inviteService.Validate( friendId, friendCode );
if (result.HasErrors) return;
friendService.AddInviteFriend( newRegUser, friendId );
}
示例3: 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 );
}
}
示例4: SetSectionValueAndValidate
public static ContentSection SetSectionValueAndValidate( long 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.PostLong( "serviceType" ) == 0) {
long serviceId = ctx.PostLong( "serviceId" );
section.ServiceId = serviceId;
section.TemplateId = ctx.PostLong( "templateId" );
}
section.SectionType = ctx.Post( "SectionType" );
validateSectionPrivate( section, ctx );
return section;
}
示例5: 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 );
}
long boardId = ctx.PostLong( "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;
}
示例6: 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.PostLong( "CategoryId" ) );
topic.TagRawString = ctx.Post( "TagList" );
return topic;
}
示例7: 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.PostLong( "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;
}
示例8: ValidatePost
public static ForumPost ValidatePost( MvcContext ctx ) {
ForumPost post = new ForumPost();
long boardId = ctx.PostLong( "forumId" );
long topicId = ctx.PostLong( "topicId" );
long parentId = ctx.PostLong( "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;
}