public ActionResult Results(int? page, string keywords = "")
        {
            string _keywords = keywords != null ? keywords.ToString().ToLower() : ""; 
            List<Work> works = new List<Work>();

            int pageSize = 20;
            int pageNumber = (page ?? 1);

            
            if(!string.IsNullOrEmpty(_keywords) && !string.IsNullOrWhiteSpace(_keywords))
            {
                works = (from wk in WorkBl.GetList()
                         where (wk.Description.ToLower().Contains(_keywords) ||
                         wk.Title.ToLower().Contains(_keywords) ||
                         wk.User.Name.ToLower().Contains(_keywords) ||
                         wk.User.Username.ToLower().Contains(_keywords))
                         orderby wk.Id descending
                         select wk).ToList();

                ViewBag.Keywords = _keywords;

                //paging                
                return View(works.ToPagedList(pageNumber, pageSize));
            }
            return View(works.ToPagedList(pageNumber, pageSize));            
        }
Example #2
0
        public ActionResult Index(int? page, int? PageSize, string sortBy)
        {
            var customers = new List<DSC_CUSTOMER>();
            var viewCustomers = new List<CustViewModel>();
            ViewBag.CurrentItemsPerPage = PageSize ?? 10;
            ViewBag.SortNameParameter = String.IsNullOrEmpty(sortBy) ? "Name desc" : "Name";
            ViewBag.SortParentParameter = sortBy == "Parent" ? "Parent desc" : "Parent"; 

            using (DSC_OBS_DB_ENTITY db = new DSC_OBS_DB_ENTITY())
            {
                customers = db.DSC_CUSTOMER.Where(cust_id => cust_id.dsc_cust_id > 0).ToList();
            }
            //DateTime active_date;
            foreach (DSC_CUSTOMER customer in customers)
            {
                string activeAction = "";
                try
                {
                    if (customer.dsc_cust_eff_end_date == null)
                    {
                        activeAction = "YES";

                    }//end of if
                    else
                    {
                        if (customer.dsc_cust_eff_end_date <= DateTime.Today)
                        {
                            activeAction = "NO";
                        }
                        else
                        {
                            activeAction = "YES";
                        }
                    }//end of else
                }//end of try
                catch
                {
                    activeAction = "NO";
                }//end of catch

                viewCustomers.Add(new CustViewModel(customer.dsc_cust_id, customer.dsc_cust_name, customer.dsc_cust_parent_name, activeAction, activeAction == "YES" ? "Deactivate" : "Activate"));
            }// end of foreach
            switch (sortBy)
            {
                case "Name desc":
                    return View(viewCustomers.OrderByDescending(x=>x.dsc_cust_name).ToPagedList(page ?? 1, PageSize ?? 10));
                case "Parent desc":
                    return View(viewCustomers.OrderByDescending(x => x.dsc_cust_parent_name).ToPagedList(page ?? 1, PageSize ?? 10));
                case"Name":
                    return View(viewCustomers.OrderBy(x => x.dsc_cust_name).ToPagedList(page ?? 1, PageSize ?? 10));
                case "Parent":
                    return View(viewCustomers.OrderBy(x => x.dsc_cust_parent_name).ToPagedList(page ?? 1, PageSize ?? 10));
                default: return View(viewCustomers.ToPagedList(page ?? 1, PageSize ?? 10));


            }

            
            
        }
Example #3
0
        public async Task<ActionResult> Index(int page = 1)
        {
            var entities = await hotelRep.Get().ToListAsync();

            var models = new List<HotelViewModel>();

            HotelViewModel model;

            foreach (var h in entities)
            {
                model = new HotelViewModel();
                model.Id = h.Id;
                model.Name = h.Name;
                model.RegionId = h.RegionId;
                model.RegionName = RegionToName(h.RegionId, "");
                model.Phone = h.Phone;
                model.Created = h.Created;
                model.Modified = h.Modified;
                model.Status = (HotelStatus)h.Status;
                var hotelImg = imgRep.FindById(h.Id, 0);
                if (hotelImg != null)
                {
                    model.ImgUrl = hotelImg.Url;
                }
                models.Add(model);
            }

            return View(models.ToPagedList(page, 10));
        }
 //
 // GET: /PhotoBook/UserAlbums
 public ActionResult UserAlbum(int page = 1)
 {
     var albumList = new List<AlbumViewModel>();
     var users = unitOfWork.UserRepository.Get();
     FillAlbumModel(users, albumList);
     return View(albumList.ToPagedList(page, Settings.Default.PhotosPerPage));
 }
Example #5
0
        public ActionResult Index(int? page)
        {
            if (Authentication.Checklogin())
            {
                int pageSize = 8;
                int pageNum = (page ?? 1);

                var _ListArea = _AreaService.GetAllAreaWithProject();
                var proObj = new List<AreaViewModel>();
                if (_ListArea != null)
                {
                    foreach (var item in _ListArea)
                    {
                        proObj.Add(
                                   new AreaViewModel()
                                   {
                                       AreaId = item.AreaId,
                                       AreaName = item.AreaName,
                                       Keyword = item.Keyword,
                                       MetaDescription = item.MetaDescription,
                                       NumOfProject = item.Projects.Count(t => t.IsDelete == false)
                                   });
                    }
                }
                ViewBag.Count = proObj.Count;
                var result = proObj.ToPagedList(pageNum, pageSize);
                ViewBag._ListArea = result;
                return View(result);
            }
            else
                return RedirectToAction("Index", "Login");
        }
        public JsonResult SomeRows(int? page, int? size)
        {
            List<DataRow> customers = new List<DataRow>();

            for (int i = 0; i < 23; i++)
            {
                customers.Add(new DataRow { Name = "Customer " + i.ToString(), DOB = (new DateTime().AddDays(i)) });
            }

            int pageNumber = page ?? 1;
            int pageSize = size ?? 5;
            var pageOfCustomers = customers.ToPagedList(pageNumber, pageSize);

            //double pageCount = System.Math.Round(totalPages,0,);
            var results = new ResultSet
            {
                Pages = pageOfCustomers.PageCount,
                Current = pageOfCustomers.PageNumber,
                IsFirst = pageOfCustomers.IsFirstPage,
                IsLast = pageOfCustomers.IsLastPage,
                HasPrevious = pageOfCustomers.HasPreviousPage,
                HasNext = pageOfCustomers.HasNextPage,
                Results = pageOfCustomers.ToList()
            };

            return Json(results);
        }
Example #7
0
 public ActionResult Index(int ? page)
 {
     if (Authentication.Checklogin())
     {
         int pageSize = 8;
         int pageNum = (page ?? 1);
         var _ListPrice = _PriceService.GetAllPrice();
         var proObj = new List<PriceViewModel>();
         if (_ListPrice != null)
         {
             foreach (var item in _ListPrice)
             {
                 proObj.Add(
                            new PriceViewModel()
                            {
                                PriceId = item.PriceId,
                                PriceValue = item.PriceValue,
                                NumOfProjects = item.Projects.Count(t => t.IsDelete == false)
                            });
             }
         }
         ViewBag.Count = proObj.Count;
         var result = proObj.ToPagedList(pageNum, pageSize);
         ViewBag._ListPrice = result;
         return View(result);
     }
     else
         return RedirectToAction("Index", "Login");
 }
        public ViewResult Index(string sortOrder, string currentFilterMMP, string currentFilterMDP, string minMonthlyPurchases, string minDollarPurchases, int? page)
        {
            int cr=0;
            int pageSize = 10;
            if (Request.HttpMethod == "GET")
            {
                minMonthlyPurchases = currentFilterMMP;
                minDollarPurchases = currentFilterMDP;
            }
            else
            {
                page = 1;
            }

            ViewBag.CurrentFilterMMP = minMonthlyPurchases;
            ViewBag.CurrentFilterMDP = minDollarPurchases;

            int pageNumber = (page ?? 1);

            if (minMonthlyPurchases != null && minDollarPurchases != null)
            {
                var Rewards = from s in serviceProxy.GetRewardsReport(sbyte.Parse(minMonthlyPurchases), decimal.Parse(minDollarPurchases), cr) select s;

                return View(Rewards.ToPagedList(pageNumber, pageSize));
            }
            else
            {
                List<SCustomer> sc = new List<SCustomer>();
                return View(sc.ToPagedList(1, 1));
            }
        }
Example #9
0
        public async Task<ActionResult> Details(int id, int page = 1, int pageSize = 20)
        {
            if (id == default(int))
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var role = await RoleManager.FindByIdAsync(id);

            if (role == null)
            {
                return HttpNotFound();
            }

            var users = new List<UserViewModel>();
            foreach (var user in UserManager.Users.ToList())
            {
                if (await UserManager.IsInRoleAsync(user.Id, role.Name))
                {
                    users.Add(new UserViewModel
                    {
                        UserName = user.UserName,
                        Email = user.Email,
                        PhoneNumber = user.PhoneNumber,
                        Created = user.Created
                    });
                }
            }

            ViewBag.RoleId = role.Id;
            ViewBag.RoleName = role.Name;
            ViewBag.RoleDescription = role.Description;
            return View(users.ToPagedList(page, 20));
        }
Example #10
0
        public ActionResult Index(int page=1)
        {
            var locations = new List<Location>();
            using (var client = new HttpClient())
            {
                var task = client.GetAsync(url)
                    .ContinueWith(request =>
                                  {
                                      request.Result.EnsureSuccessStatusCode();
                                      var readTask=request.Result.Content.ReadAsAsync<List<Location>>()
                                          .ContinueWith(read =>
                                                        {
                                                            locations = read.Result;
                                                        });
                                      readTask.Wait();
                                  }).ContinueWith(error =>
                                                  {
                                                      if (error.Exception != null)
                                                          ViewBag.Error = error.Exception.StackTrace;
                                                  });
                task.Wait();
            }

            SetExtraData();

            return View(locations.ToPagedList(page, 6));
        }
        public ActionResult Index(int ? Id,int ? page)
        {
            int pageSize = 5;
            int pageNum = (page ?? 1);

            ViewBag.Sektori = ctx.Sektoris.Where(x => x.IsActive == true).ToList();

            if(Id!=null)
            {
                int id = Id ?? default(int);
                Sektori s = ctx.Sektoris.Where(x => x.SektorID == id).SingleOrDefault();

                if (s != null)
                {
                    ViewData["Sektor"] = s;

                    List<ObavijestiSektori> sek = ctx.ObavijestiSektoris.Where(x => x.SektorID == s.SektorID && x.IsActive == true).OrderByDescending(x=>x.ObavijestSektorID).ToList();

                    List<Obavijesti> obavijesti = new List<Obavijesti>();

                    foreach (ObavijestiSektori item in sek)
                    {
                        Obavijesti o = ctx.Obavijestis.Where(x => x.ObavijestID == item.ObavijestID && x.IsActive == true).SingleOrDefault();

                        if (o != null)
                            obavijesti.Add(o);
                    }
                    return View(obavijesti.ToPagedList(pageNum, pageSize));
                }
            }
            return RedirectToAction("Index", "Index");
        }
        public ActionResult Index(int ? page )
        {
            if (Authentication.Checklogin())
            {
                int pageSize = 8;
                int pageNum = (page ?? 1);
                var _listProjectType = _projectType.GetListProjectType();
                var proObj = new List<ProjectTypeViewModel>();
                if (_listProjectType != null)
                {
                    foreach (var item in _listProjectType)
                    {
                        proObj.Add(
                                   new ProjectTypeViewModel()
                                   {
                                       Name = item.NameType,
                                       Image = item.Image,
                                       ProjectTypeId = item.ProjectTypeId,
                                       Description = item.Description,
                                       Keyword = item.Keyword,
                                       MetaDescription = item.MetaDescription,
                                       NumOfProject = item.Projects.Count(t=>t.IsDelete==false)
                                   });
                    }
                }

                ViewBag.Count = proObj.Count;
                var result = proObj.ToPagedList(pageNum, pageSize);
                ViewBag._listProjectType = result;
                return View(result);
            }
            else
                return RedirectToAction("Index", "Login");
        }
        public ActionResult Index(string roleId, int index = 1)
        {
            //取role列表
            var roles = _roleManager.Roles.ToList();
            //roleId是否为空
            if (string.IsNullOrWhiteSpace(roleId))
            {
                //取第一个role的id
                roleId = roles.FirstOrDefault().Id;
            }
            //放入viewbag,设置默认值
            ViewBag.RoleID = new SelectList(roles, "ID", "Name", roleId);
            //取角色权限列表
            var permissions = _roleManager.GetRolePermissions(roleId);
            //创建ViewModel
            var permissionViews = new List<PermissionViewModel>();

            //var map = Mapper.CreateMap<ApplicationPermission, PermissionViewModel>();
            permissions.Each(t =>
            {
                var view = Mapper.Map<PermissionViewModel>(t);
                view.RoleId = roleId;
                permissionViews.Add(view);
            });
            //排序
            permissionViews.Sort(new PermissionViewModelComparer());
            return View(permissionViews.ToPagedList(index, 10));
        }
Example #14
0
        public async Task<ActionResult> Index(int page = 1)
        {
            var orders = await orderRep.Get().OrderByDescending(o => o.OrderDate).ToListAsync();

            var models = new List<OrderViewModel>();

            OrderViewModel model;

            foreach (var o in orders)
            {
                model = new OrderViewModel();
                model.OrderId = o.OrderId;
                model.UserId = o.UserId;
                model.UserName = o.FullName;
                model.PhoneNumber = o.PhoneNumber;
                model.Email = o.Email;
                model.Remark = o.Remark;
                model.OrderDate = o.OrderDate;
                model.Amount = o.Amount;
                model.ShippingTo = o.ShippingTo;
                model.OrderStatus = o.OrderStatus;
                model.ShippingAddress = o.ShippingAddress;
                model.ShippingStatus = o.ShippingStatus;

                models.Add(model);
            }

            return View(models.ToPagedList(page, 10));
        }
Example #15
0
        // GET: /Ads/
        public ActionResult Index(int? page)
        {
            if (Authentication.Checklogin())
            {
                int pageSize = 8;
                int pageNum = (page ?? 1);

                var _ListAds = _adsService.GetAllAds();
                var proObj = new List<AdsViewModel>();
                if (_ListAds != null)
                {
                    foreach (var item in _ListAds)
                    {
                        proObj.Add(
                                   new AdsViewModel()
                                   {
                                       AdsId = item.AdsId,
                                       Name = item.Name,
                                       Image = item.Image,
                                       URL = item.URL,
                                       IsShow = item.IsShow == true ? "Có" : "Không"
                                   });
                    }
                }
                ViewBag.Count = proObj.Count;
                var result = proObj.ToPagedList(pageNum, pageSize);
                ViewBag._ListAds = result;
                return View(result);
            }
            else
                return RedirectToAction("Index", "Login");
        }
        public ActionResult CommentsOfTopReview(int? page, String IDPhim, String IDReview = "-1")
        {          
            List<CommentViewModels> result = new List<CommentViewModels>();
            ReviewFilmService reviewS = new ReviewFilmService();
            TopReviewModels top = null;
            ViewBag.IDPhim = IDPhim;
            ViewBag.IDReview = IDReview;
            if(IDReview.Equals("-1")) // Bài Review nổi bật nhất
            {
                top = reviewS.getTopReview(IDPhim);
            }
            else
            {
                top = reviewS.getReview(IDReview);
            }
            
            if(top != null)
            {
                result = reviewS.getComment(top.MS_ReView.ToString());

                TempData["IDPost"] = top.MS_ReView;
            }

            int pageNumber = page ?? 1;
            int pageSize = 10;
            
            return PartialView(result.ToPagedList(pageNumber, pageSize));
        }
Example #17
0
        public ActionResult GameDev(int? page)
        {
            var userList = from user in jobRepo.GetUsers() select user;
            var users = new List<MyApplication.Job>();
            if (userList.Any())
            {
                foreach (var user in userList)
                {
                    if (user.Category.Equals("Game Developer           ") && user.Status.Equals(true))
                        {
                            var Name = accountRepo.GetUsers().FirstOrDefault(u => u.UserId.Equals(user.UserId));
                            ViewBag.Name = Name.Username;
                            ViewBag.Head = "Game Developer";
                        users.Add(new MyApplication.Job()
                        {
                            Title = user.Title,
                            InitialBudget = user.InitialBudget,
                            finalBudget = user.finalBudget,
                            Category = user.Category,
                            JobId = user.JobId,
                            Date = user.Date
                        });
                    }
                }
            }

            int pageSize = 20;
            int pageNumber = (page ?? 1);

            return View("CategoryJob", users.ToPagedList(pageNumber, pageSize));
        }
Example #18
0
        public ActionResult Index(int? page)
        {
            if (Authentication.Checklogin())
            {
                int pageSize = 8;
                int pageNum = (page ?? 1);

                var _ListNew = _NewsService.GetAllNew();
                var proObj = new List<NewViewModel>();
                if (_ListNew != null)
                {
                    foreach (var item in _ListNew)
                    {
                        proObj.Add(
                                   new NewViewModel()
                                   {
                                       NewId = item.NewId,
                                       Content = item.Content,
                                       CreateDate = item.CreateDate.ToShortDateString(),
                                       Image = item.Image,
                                       ShortDes = item.ShortDes,
                                       MetaDescription = item.MetaDescription,
                                       Keyword = item.Keyword,
                                       Title = item.Title
                                   });
                    }
                }
                ViewBag.Count = proObj.Count;
                var result = proObj.ToPagedList(pageNum, pageSize);
                ViewBag._ListNew = result;
                return View(result);
            }
            else
                return RedirectToAction("Index", "Login");
        }
        public ActionResult Search(string search, string searchBy, string sortBy, int? page)
        {
            ViewBag.SortNameParameter = string.IsNullOrEmpty(sortBy) ? "Name desc" : "";

            List<Message> SearchResults = new List<Message>();

            if (!string.IsNullOrWhiteSpace(search))
            {
                foreach (var message in fe.Messages)
                {
                    SearchResults.Add(message);
                }

                if (string.IsNullOrWhiteSpace(search) != true)
                    SearchResults = SearchResults.Where(m => m.Content.Contains(search)).ToList();

                switch (sortBy)
                {
                    case "Name desc":
                        SearchResults = SearchResults.OrderByDescending(a => a.MessageId).ToList();
                        break;
                    default:
                        SearchResults = SearchResults.OrderBy(a => a.MessageId).ToList();
                        break;
                }
            }

            return View(SearchResults.ToPagedList(page ?? 1, 3));
        }
Example #20
0
 public ActionResult Index(int? page)
 {
     if (Authentication.Checklogin())
     {
         int pageSize = 8;
         int pageNum = (page ?? 1);
         var _listContractor = _contractorServices.GetAllContractor();
         var proObj = new List<ContractorViewModel>();
         if (_listContractor != null)
         {
             foreach (var item in _listContractor)
             {
                 proObj.Add(
                            new ContractorViewModel()
                            {
                                ContractorId = item.ContractorId,
                                Image = item.Image,
                                Name = item.Name,
                                LinkContent = item.LinkContent
                            });
             }
         }
         ViewBag.Count = proObj.Count;
         var result = proObj.ToPagedList(pageNum, pageSize);
         ViewBag._listContractor = result;
         return View(result);
     }
     else
         return RedirectToAction("Index", "Login");
 }
Example #21
0
        public async Task<ActionResult> Index(int hotelid = 0, int page = 1)
        {
            ViewBag.HotelId = 0;
            ViewBag.HotelName = "";
            List<Room> rooms;
            if (hotelid == default(int))
            {
                rooms = await roomRep.Get().ToListAsync();
            }
            else
            {
                rooms = await roomRep.Get(r => r.HotelId == hotelid).ToListAsync();
                ViewBag.HotelId = hotelid;
                ViewBag.HotelName = hotelRep.FindById(hotelid).Name;
            }

            var roomsView = new List<RoomViewModel>();

            foreach (var r in rooms)
            {
                roomsView.Add(new RoomViewModel
                {
                    Id = r.Id,
                    HotelId = r.HotelId,
                    HotelName = hotelRep.FindById(r.HotelId).Name,
                    Name = r.Name,
                    StandartPrice = r.StandartPrice,
                    Price = r.Price,
                    Quantity = r.Quantity,
                    Status = (RoomStatus)r.Status
                });
            }

            return View(roomsView.ToPagedList(page, 10));
        }
        // GET: Student
        public async Task<ActionResult> Index(string sort = "id", int? page = 1, string fields = "id,name,address")
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:53506/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                HttpResponseMessage response = await client.GetAsync("api/student?sort=" + sort + "&page=" + page + "&fields=" + fields);
                if (response.IsSuccessStatusCode)
                {
                    List<Student> students = await response.Content.ReadAsAsync<List<Student>>();

                    List<StudentViewModel> model = new List<StudentViewModel>();
                    StudentDTO dto = new StudentDTO();
                    model = dto.ConvertToStudentViewModel(students);

                    int pageSize = 3;
                    int pageNumber = (page ?? 1);
                    return View(model.ToPagedList(pageNumber, pageSize));
                }

                var re = response.Content.ReadAsStringAsync().Result;

            }            

            return View("Error");
        }
 public ActionResult Information(int iduser, int? page)
 {
     int pageSize = 10;
     int pageNumber = (page ?? 1);
     List<TweetsModel> currentTweetsList = new List<TweetsModel>();
     currentTweetsList = curentTweetService.GetAllTweets(iduser).OrderByDescending(xTweet => xTweet.id_tweet).ToList();
     return View("Information", currentTweetsList.ToPagedList(pageNumber, pageSize));
 }
Example #24
0
 public ActionResult Information(int? page)
 {
     int pageSize = 10;
     int pageNumber = (page ?? 1);
     List<UsersModel> currentUserList = new List<UsersModel>();
     currentUserList = currentUserService.GetAll().OrderByDescending(xUser => xUser.id_user).ToList();
     return View("Information", currentUserList.ToPagedList(pageNumber, pageSize));
     logger.Debug("You called the method \"GetAll\"");
 }
 public ActionResult VeHuu(int? page)
 {
     //List<NhanVien> list = bizNV.BIZ_LayDuLieuNV();
     list = bizNV.BIZ_LayDuLieuNV();
     TempData["list"] = list;
     int pageSize = 10;
     int pageNumber = (page ?? 1);
     return View(list.ToPagedList(pageNumber, pageSize));
 }
Example #26
0
 public SPlistViewModel(List<SPViewModel> picks, int? page)
 {
     if (page.HasValue)
     {
         _Page = page.Value;
     }
     _Picks = picks;
     _PickPages = _Picks.ToPagedList(_Page, 10);
 }
Example #27
0
        public ActionResult BookSearch(string q, string currentFilter, int? page, int? formCountry, int? formProvince, int? formCity)
        {
            if (Request.HttpMethod == "GET")
            {
                q = currentFilter;
            }
            else
            {
                page = 1;
            }
            ViewBag.CurrentFilter = q;

            var books = new List<Book>();

            if (!String.IsNullOrWhiteSpace(q))
            {
                books = db.Books
                                .Where(a => a.Title.Contains(q)).OrderBy(a => a.Title)
                                .ToList();

                if (books.Count == 0)
                {
                    Information(EMPTY);
                }
            }
            else
            {
                books = db.Books.OrderBy(a => a.Title).ToList();
            }

            if (formCountry != null && formCountry != 0)
            {
                books = books.Where(b => b.User.Address.CountryId == formCountry).ToList();
                ViewBag.CurrentCountryId = formCountry;
                ViewBag.CurrentCountryName = db.Countries.Find(formCountry).Name;
            }

            if (formProvince != null && formProvince != 0)
            {
                books = books.Where(b => b.User.Address.ProvinceId == formProvince).ToList();
                ViewBag.CurrentProvinceId = formProvince;
                ViewBag.CurrentProvinceName = db.Provinces.Find(formProvince).Name;
            }

            if (formCity != null && formCity != 0)
            {
                books = books.Where(b => b.User.Address.CityId == formCity).ToList();
                ViewBag.CurrentCityId = formCity;
                ViewBag.CurrentCityName = db.Cities.Find(formCity).Name;
            }

            int pageSize = 10;
            int pageNumber = (page ?? 1);
            return View(books.ToPagedList(pageNumber, pageSize));
        }
Example #28
0
 public ActionResult Index(int? page)
 {
     int itemsPerPage = 25;
     int pageNumber = page ?? 1;
     List<Lucky> luckyGuids = new List<Lucky>();
     for (int i = 0; i < 100; i++)
     {
         luckyGuids.Add(new Lucky() { Guid = Guid.NewGuid().ToString() });
     }
     return View(luckyGuids.ToPagedList(pageNumber, itemsPerPage));
 }
Example #29
0
		public void Zero_Item_Data_Set_Returns_Zero_Pages()
		{
			//arrange
			var data = new List<object>();

			//act
			var pagedList = data.ToPagedList(1, 10);

			//assert
			Assert.Equal(0, pagedList.PageCount);
		}
 public async Task<ActionResult> Index(int index = 1)
 {
     var users = await _userManager.Users.ToListAsync();
     var views = new List<EditUserRoleViewModel>();
     foreach (var user in users)
     {
         var view = Mapper.Map<EditUserRoleViewModel>(user);
         views.Add(view);
     }
     return View(views.ToPagedList(index, 10));
 }