Exemple #1
0
        public void AlbumsIndexTest()
        {
            AlbumsController controller = new AlbumsController(new StagingMusicsRepository());

            // Act
            ViewResult result = controller.Index("", "", "", 0) as ViewResult;

            PagedList.PagedList <Album> model = (PagedList.PagedList <Album>)result.ViewData.Model;
            // Act


            // Assert
            Assert.IsNotNull(result);
            //  Assert.IsTrue(model.Count() == 2);

            //Route
            //Assert.AreEqual("Index", result.RouteValues["action"]);
            //Assert.AreEqual("SomeElse", result.["controller"]);

            ///Search Test
            // Act
            result = controller.Index("", "", "The Best", 0) as ViewResult;
            model  = (PagedList.PagedList <Album>)result.ViewData.Model;
            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(model.TotalItemCount == 1);
        }
Exemple #2
0
        // GET: Utility
        public ActionResult CreateCountry(int?page)
        {
            var result = iUnitOfWork.Repository <Country>().GetAll().Select(x => new Country()
            {
                Name = x.Name, Id = x.Id, IsActive = x.IsActive
            }).ToList();

            PagedList.IPagedList <Country> countryResult = new PagedList.PagedList <Country>(result, page ?? 1, pageSize);

            return(View(countryResult));
        }
Exemple #3
0
 public void RefreshData(List <BakingErrorRecord> db)
 {
     if (db != null)
     {
         int index = db.Count % 10 > 0 ? 1 : 0;
         int test  = db.Count / 10 + index;
         this.pager.Setup((IPagedData) new PagedData <object>()
         {
             PageNumber = this.pager.PageNumber,
             PageCount  = test,
             PageSize   = 10,
         });
         IPagedList <BakingErrorRecord> pagerList = new PagedList.PagedList <BakingErrorRecord>(from m in db select m, this.pager.PageNumber, 10);
         PagedData <BakingErrorRecord>  model     = new PagedData <BakingErrorRecord>(pagerList);
         this.dataGrid.ItemsSource = model;
     }
 }
 public IActionResult AutomaticOrder(int Quantity, Decimal Cost, PagedList.PagedList <Book> ListofBookOrder)
 {
     return(View("Index"));
 }