public async override Task PreRender() { if (!ShowVideo) { if (!string.IsNullOrEmpty(Context.Parameters["Id"].ToString()) && !string.IsNullOrEmpty(Context.Parameters["Name"].ToString())) { PornRepository PornRep = new PornRepository(); try { Id = Convert.ToInt16(Context.Parameters["Id"].ToString()); Name = Context.Parameters["Name"].ToString(); } catch { Context.RedirectToRoute("Default"); } if (Videos.IsFirstPage) { CategoryCount = await PornRep.GetCategoryVideosCount(Id); } Videos.OnLoadingData = option => PornRep.GetVideosByCategory(option, Id, VideoSwitch, LoadMobile, currentCulture); } } await base.PreRender(); }