public PagedResultDto <InvoiceDto> GetAll(PagedUserResultRequestDto input) { var query = (from inv in _repository.GetAll() join o in _orderRepository.GetAll() on inv.OrderId equals o.Id join c in _customerRepository.GetAll() on o.CustomerId equals c.Id select new InvoiceDto { Id = inv.Id, OrderId = o.Id, InvoiceNumber = inv.InvoiceNumber, PaidAmount = inv.PaidAmount, InvoiceDate = inv.InvoiceDate, CustomerName = c.CustomerName, }) .Skip(input.SkipCount) .Take(input.MaxResultCount) .ToList(); var result = new PagedResultDto <InvoiceDto> { Items = query, TotalCount = query.Count }; return(result); }
public async Task <JsonResult> GridData() { var input = new PagedUserResultRequestDto(); input.MaxResultCount = int.Parse(Request.Form["rows"]); input.SkipCount = (int.Parse(Request.Form["page"]) - 1) * input.MaxResultCount; var output = await _userAppService.GetAll(input); return(Json(new { total = output.TotalCount, rows = output.Items })); }
public async Task <JsonResult> GridData() { var p = GetOnlyPagedInput(); var input = new PagedUserResultRequestDto() { IsWorker = true }; input.MaxResultCount = p.MaxResultCount; input.SkipCount = p.SkipCount; var output = await _userAppService.GetAll(input); return(Json(new { total = output.TotalCount, rows = output.Items })); }
public async Task GetAllUsers_Test() { await CreateComplexRoleAndOrgUnit(); int userCount = 50; for (int i = 10; i < userCount; i++) { CreateUserDto createUserDto = new CreateUserDto() { UserName = $"TestUser{i,2}", Password = User.DefaultPassword, Name = $"Test{i,2}", Surname = $"User{i,2}", PhoneNumber = $"138514000{i,2}", RoleNames = new[] { "Role1" }, OrgUnitNames = new[] { "Ou Test" }, IsActive = true }; var userDto = await _userAppService.CreateAsync(createUserDto); } PagedUserResultRequestDto input = new PagedUserResultRequestDto() { IsActive = true, Keyword = string.Empty, SkipCount = 17, MaxResultCount = 6 }; var users = await _userAppService.GetAllAsync(input); users.Items.Count.ShouldBe(6); users.Items[0].UserName.ShouldBe("TestUser26"); users.Items[0].OrgUnitNames.Length.ShouldBe(1); users.Items[0].RoleNames.Length.ShouldBe(2); users.Items[0].Permissions.Length.ShouldBe(2); }