2012-06-06 182 views
0

我有一個控制器控制傳遞給另一種方法,在同一控制器

public ActionResult Index() 
{ 
    //SomeCode Here 
} 


public ActionResult CommingFromAnotherDomain(bool Result) 
{ 
    if(Result) 
    { 
     //How to pass control to upper method?? 
    } 
} 

CommingFromAnotherDomain將執行第一但如果條件檢查參數之後。我如何將控制權交給上方法Index()。

而且我也想在索引中檢查下面的結果,以便我可以從該索引方法中刪除一些工作。

在此先感謝。

+0

您正在尋找一些beyone'return RedirtToAction'? –

+0

你應該用路由處理這個。 – asawyer

回答

2
public ActionResult Index() 
{ 
    //SomeCode Here 
} 


public ActionResult CommingFromAnotherDomain(bool Result) 
{ 
    if(Result) 
    { 
     return Index(); 
    } 
    // some code... 
} 
+0

這有助於...... – Pankaj

0

在你的Global.asax中,你可以提供下面的路由(或者接近它的東西),以便到達Index Controller方法。

 routes.MapRoute(
      "ComingFromAnotherDomain", // Route name 
      "YourController/ComingFromAnotherDomain/{result}", 
      new { controller = "YourController", action = "Index", result = UrlParameter.Optional } 
+0

但他只需要它'result = true' – ivowiblo

相關問題