本文整理汇总了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 );
}
示例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 );
}
示例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;
}
示例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;
}
示例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 );
}
示例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 );
}
}
示例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 );
}
示例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();
}
示例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;
}
示例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();
}
示例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 );
}
示例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;
}
示例13: IsMakeHtml
public static Boolean IsMakeHtml( MvcContext ctx ) {
if (ctx.GetItem( "_makeHtml" ) == null) return false;
Boolean isMakeHtml = (Boolean)ctx.GetItem( "_makeHtml" );
return isMakeHtml;
}
示例14: GetPostListFromContext
public static List<ContentPost> GetPostListFromContext( MvcContext ctx ) {
return ctx.GetItem( "_currentContentPostList" ) as List<ContentPost>;
}
示例15: GetPostFromContext
public static ContentPost GetPostFromContext( MvcContext ctx ) {
return ctx.GetItem( "_currentContentPost" ) as ContentPost;
}