public ActionResult Index(int?page) { long?userId = null; if (User.Identity.IsAuthenticated) { userId = User.Identity.GetUserId <long>(); } var model = _problemsService.GetProblemsList(page ?? 1, _pageSize, userId, false); return(View(model)); }
public void FirstPageTest() { const int pageSize = 100; const int page = 1; var tasks = new[] { new TaskName { Id = 1, Name = "A" }, new TaskName { Id = 2, Name = "B" } }; _taskRepository.Stub(o => o.GetTasks(OpenedTasksSpecification.Instance, page, pageSize)).Return(tasks); _taskRepository.Stub(o => o.Count(true)).Return(tasks.Length); var model = _service.GetProblemsList(page, pageSize, null, true); Assert.That(model.ProblemsCount, Is.EqualTo(2)); Assert.That(model.Pagination.PageSize, Is.EqualTo(pageSize)); Assert.That(model.Pagination.CurrentPage, Is.EqualTo(page)); Assert.That(model.Pagination.TotalPages, Is.EqualTo(1)); CollectionAssert.AreEqual(tasks.Select(o => new { o.Id, o.Name }), model.Problems.Select(o => new { o.Id, o.Name })); }
public ActionResult Problems(int?page) { var model = _problemsService.GetProblemsList(page ?? 1, 20, null, false); return(View(model)); }