public ActionResult Index() { AccessTokenService service = new AccessTokenService(); service.UpdateToken(); return View(); }
void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext) { if (Brands == null) { try { BrandService service = new BrandService(); Brands = service.GetListBrand(); } catch (Exception) { AccessTokenService tkService = new AccessTokenService(); tkService.UpdateToken(); BrandService service = new BrandService(); Brands = service.GetListBrand(); } } filterContext.Controller.ViewBag.Brands = Brands; filterContext.Controller.ViewBag.LinkService = LinkService; this.OnActionExecuting(filterContext); }