public ActionResult TabClick(int TabID) { IndexViewData = (IndexDataModel)Session["IndexData"]; WorkWithOffers WWO = new WorkWithOffers(Server); if (IndexViewData == null) { IndexViewData = new IndexDataModel(); } switch (TabID) { case 1: IndexViewData.ShowTopOffers(); IndexViewData.TopOffers = WWO.GetTopOffers(); break; case 2: WorkWithUsers WWU = new WorkWithUsers(); IndexViewData.ShowTopUsers(); IndexViewData.TopUsers = WWU.GetTopUsers(); break; case 3: IndexViewData.ShowNewOffers(); IndexViewData.NewOffers = WWO.GetNewOffers(); break; } Session["IndexData"] = IndexViewData; return(RedirectToAction("Index", "Home")); }
public ActionResult Index() { IndexViewData = (IndexDataModel)Session["IndexData"]; WorkWithTags WWT = new WorkWithTags(); WorkWithOffers WWO = new WorkWithOffers(Server); WorkWithUsers WWU = new WorkWithUsers(); if (IndexViewData == null) { IndexViewData = new IndexDataModel(); IndexViewData.ShowString = "NewOffers"; IndexViewData.NewOffers = WWO.GetNewOffers(); } IndexViewData.WeightTags = WWT.GetWeightTags(); ViewBag.ViewData = IndexViewData; Session["IndexData"] = IndexViewData; if (User.Identity.Name != "") { if (WWU.GetUserRole(IdentityExtensions.GetUserId(User.Identity)) == "Banned") { return(RedirectToAction("UserBanned", "AccessDenied")); } } if (IndexViewData.ShowString == "NewOffers") { IndexViewData.NewOffers = WWO.GetNewOffers(); } if (IndexViewData.ShowString == "TopUsers") { IndexViewData.TopUsers = WWU.GetTopUsers(); } if (IndexViewData.ShowString == "TopOffers") { IndexViewData.NewOffers = WWO.GetTopOffers(); } return(View()); }