// GET: /<controller>/ public IActionResult Index() { IEnumerable <Client> list = _dataservice.getAll(); DisplayAllViewModel vm = new DisplayAllViewModel(); vm.ClientList = list; return(View(vm)); }
public async Task <ActionResult> Index() { var fullDisplayModel = await _display.DisplayModels(); var displayvm = new DisplayAllViewModel(fullDisplayModel); return(View(displayvm)); }
public void Test_empty_page() { var model = new DisplayAllViewModel(3, 4, _materials.Count(), _materials.Skip(9).Take(3), new Dictionary <int, MaterialStatisticViewModel>()); Assert.AreEqual(0, model.Materials.Count(), "Wrong materials count."); Assert.AreEqual(4, model.CurrentPageNumber, "The number of current page is invalid."); Assert.AreEqual(3, model.TotalPagesCount, "The pages count is iinvalid."); }
public void Test_second_not_full_page() { var model = new DisplayAllViewModel(3, 3, _materials.Count(), _materials.Skip(6).Take(3), new Dictionary <int, MaterialStatisticViewModel>()); Assert.AreEqual(1, model.Materials.Count(), "Wrong materials count."); Assert.AreEqual("n6", model.Materials.First().Name, "The first element is wrong."); Assert.AreEqual(3, model.CurrentPageNumber, "The number of current page is invalid."); Assert.AreEqual(3, model.TotalPagesCount, "The pages count is iinvalid."); }
public async Task <ActionResult> DisplayAll() { var model = new DisplayAllViewModel { KnownWords = await _vocabularyService.GetKnownWords(User.Identity.GetUserId <int>()), LearnWords = await _vocabularyService.GetLearnWords(User.Identity.GetUserId <int>()) }; return(View(model)); }
/// <summary>Shows all types of materials on the page.</summary> /// <param name="pageNumber">The number of current page.</param> /// <returns>Materials list page.</returns> public async Task <ActionResult> DisplayAll(int pageNumber = 1) { var materials = await _materialService.GetMaterialsWithFile(pageNumber, PageSize); var statistic = materials.ToDictionary(m => m.Id, m => new MaterialStatisticViewModel { AllWordsCount = _materialService.WordsCountInMaterial(m) }); var model = new DisplayAllViewModel(PageSize, pageNumber, _materialService.TotalCount(), materials, statistic); return(View(model)); }