ベースコントローラー:
public class AnaController : Controller
{
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
ViewBag.AktifKullanici = kullaniciServis.AktifKullanici(KullaniciEposta);
base.OnActionExecuting(filterContext);
}
}
上記のコントローラーから継承されたコントローラー:
public class AnasayfaController : AnaController
{
private HaberSitesiDbContext db;
private HaberServis haberServis;
private KullaniciServis kullaniciServis;
public AnasayfaController()
{
this.db = new HaberSitesiDbContext();
this.haberServis = new HaberServis(db);
this.kullaniciServis = new KullaniciServis(db);
}
// !!! following methods called twice !!!
public ActionResult Index()
{
return View();
}
public ActionResult _SolManset()
{
// id si 2 olanlar sol manset haberleri
var haberler = haberServis.PozisyonHaberler(2, 3)
.ToList();
return PartialView(haberler);
}
public ActionResult _Slider()
{
// id si 1 olanlar slider haberleri
var haberler = haberServis.PozisyonHaberler(1, 19)
.ToList();
return PartialView(haberler);
}
public ActionResult _Yazarlar()
{
var yazarlar = haberServis.KoseYazilari(5)
.ToList();
return PartialView(yazarlar);
}
protected override void Dispose(bool disposing)
{
db.Dispose();
base.Dispose(disposing);
}
}
レイアウト:
...
<article id="body">
@RenderBody()
</article>
...
索引:
<aside class="aside_small float_left">
@Html.Action("_SolManset", "Anasayfa")
</aside>
<section class="section_middle">
@Html.Action("_Slider", "Anasayfa")
</section>
<aside class="aside_small float_right">
@Html.Action("_Yazarlar", "Anasayfa")
</aside>
解決策が見つかりません。なにか提案を?余分なコードや js コードはありません。2 番目の呼び出しがどこから来たかを調べるにはどうすればよいですか?