public ActionResult Index() { var defaultPageSize = 5; int? Page = 1; List <Batches> Batches = new List <Batches>(); List <YearsforFaculty> Years = new List <YearsforFaculty>(); if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"]); View_UserDetails Userdetails = UserDetailsViewService.GetUserByUserId(Convert.ToInt32(UserId)); if (Userdetails.RoleId == "4") { Batches.Add(new Batches { Batch = "Visible To All", BatchName = "Visible To All" }); Batches.Add(new Batches { Batch = Convert.ToString(Userdetails.Batch), BatchName = "My BatchMates" }); for (int?i = Userdetails.WorkingFrom; i <= Userdetails.WorkingTo; i++) { Years.Add(new YearsforFaculty { Year = Convert.ToString(i) }); } } WhiteBoardModel WhiteBoard = new WhiteBoardModel() { Viewdetails = Batches, RoleId = Userdetails.RoleId, Batch = Userdetails.Batch, Stream = Userdetails.CourseName, Events = EventCategoryService.GetCategorys(), yearsList = Years, Coursecategorys = CategoryServices.GetAllCourseCategories(), }; ViewBag.Userdata = GenericMethods.AlumniAdnFacultyData(UserId, Convert.ToString(Userdetails.Batch), Convert.ToInt32(Userdetails.Years), Userdetails.CourseCategoryName); return(View(WhiteBoard)); } return(RedirectToAction(LoginPages.Login, LoginPages.Account, new { area = "" })); }