public async Task <PagedResult <TransactionDto> > GetPaged(ListRequestDto request) { var data = _dbContext.Transaction.Include(x => x.TransactionType) .Include(x => x.DestCustomer) .Include(x => x.OriginCustomer) .Include(x => x.TransactionDetail) .GetPaged <Transaction, TransactionDto>(request.page, request.pageSize); return(await Task.FromResult(data)); }
/// <summary> /// Gets items /// </summary> /// <param name="listRequest">The list request</param> /// <returns></returns> public async Task <IEnumerable <TDto> > GetItemsAsync(ListRequestDto listRequest) { var listRequestEntity = Mapper.Map <ListRequest>(listRequest); var repository = UnitOfWork.GetRepository <TRepository>(); var entities = await repository.GetItemsAsync(listRequestEntity); var dto = Mapper.Map <IEnumerable <TDto> >(entities); return(dto); }
public IActionResult Get([FromQuery] ListRequestDto request) { var list = _accountService.GetAll() .OrderByDescending(t => t.CreationTime) .ToPagedList(request.Page, request.PageSize); var result = new PagedListResultDto <AccountDto>(list.Select(t => new AccountDto() { Id = t.Id, UserName = t.UserName, DisplayName = t.DisplayName, }), list.TotalCount); return(Ok(result)); }
public IActionResult Get([FromQuery] ListRequestDto request) { var list = _securityTokenService.GetAll() .OrderByDescending(t => t.CreationTime) .ToPagedList(request.Page, request.PageSize); var result = new PagedListResultDto <SecurityTokenDto>(list.Select(t => new SecurityTokenDto() { Id = t.Id, Expired = t.Expired, Token = t.Token }), list.TotalCount); return(Ok(result)); }
public async Task <IActionResult> Index(ListRequestDto <UserListDto> requestDto) { var client = new RestClient(_configuration["Api:Url"] + "user/index"); var request = new RestRequest(Method.GET); request.RequestFormat = DataFormat.Json; var token = HttpContext.Session.GetString("JWToken"); client.Authenticator = new JwtAuthenticator(token); var response = await client.ExecuteAsync <ListResponseDto <UserListDto> >(request); return(View(response.Data.List)); }
public async Task <ActionResult <ListResponseDto <UserListDto> > > Index() { var identity = User.Identity as ClaimsIdentity; var userId = long.Parse(identity.FindFirst(ClaimTypes.NameIdentifier).Value); var request = new ListRequestDto <UserListRequestDto>(); request.Search = new UserListRequestDto { UserId = userId }; var result = await _userQuery.List(request); return(Ok(result)); }
public async Task <PagedResult <TransactionTypeDto> > GetPaged(ListRequestDto request) { PagedResult <TransactionTypeDto> data; if (request.filter.filters.Any()) { var filter1 = request.filter.filters.FirstOrDefault(); data = _dbContext.TransactionType.Where(x => x.Name.Contains(filter1.value)).GetPaged <TransactionType, TransactionTypeDto>(request.page, request.pageSize); } else { data = _dbContext.TransactionType.GetPaged <TransactionType, TransactionTypeDto>(request.page, request.pageSize); } return(await Task.FromResult(data)); }
public async Task <ListResponseDto <ContactListDto> > List(ListRequestDto <ContactListRequestDto> request) { var list = await(from u in _contactManagerContext.Contacts where u.IsRemove == false && u.Id != request.Search.UserId select new ContactListDto { FirstName = u.FirstName, LastName = u.LastName, PhoneNumber = u.PhoneNumber, }).GetPaged(request.Page, request.PageSize, null).ToListAsync(); return(new ListResponseDto <ContactListDto> { List = list, PageSize = list.Count(), Page = request.Page }); }
public IHttpActionResult Get(ListRequestDto request) { using (Session session = EnovaClient.Login.CreateSession(true, false)) { CRMModule cm = CRMModule.GetInstance(session); Kontrahenci kontrahenci = cm.Kontrahenci; var view = kontrahenci.CreateView(); var pageSize = request.PageSize ?? KONTRAHENCI_PAGE_SIZE; var skip = request.PageNumber * pageSize; var rows = view.Skip(skip).Take(pageSize).Cast <Kontrahent>() .Select(KontrahentListItemDto.FromEnova).ToArray(); return(Ok(new TotalCountResponseDto { TotalCount = kontrahenci.CreateView().Count(), Results = rows })); } }
public async Task <PagedResult <CustomerDto> > GetPaged(ListRequestDto request) { PagedResult <CustomerDto> data; if (request.filter.filters.Any()) { var filter1 = request.filter.filters.FirstOrDefault(); data = _dbContext.Customer.Where(x => x.Name.StartsWith(filter1.value)).GetPaged <Customer, CustomerDto>(request.page, request.pageSize); } else { data = _dbContext.Customer.GetPaged <Customer, CustomerDto>(request.page, request.pageSize); } //Use a SPROC to get the last balance var paramIn = new SqlParameter { ParameterName = "userId", DbType = System.Data.DbType.Int64, Direction = System.Data.ParameterDirection.Input }; var paramOut = new SqlParameter { ParameterName = "result", DbType = System.Data.DbType.Double, Direction = System.Data.ParameterDirection.Output }; data.Data.ForEach(x => { paramIn.Value = x.Id; _dbContext.Database.ExecuteSqlCommand("[dbo].[usp_GetCustomerLastBalance] @userId, @result OUT", paramIn, paramOut); x.LastBalance = (double)paramOut.Value; }); return(await Task.FromResult(data)); }
public async Task <IActionResult> ListTransactionTypesAsync([FromBody] ListRequestDto request) { var result = await _transactionService.GetTransactionTypes(request); return(Ok(result)); }
public async Task <ListResponseDto <ContactListDto> > List(ListRequestDto <ContactListRequestDto> request) { var list = await _unitOfWork.ContactRepository.List(request); return(list); }
public Task <IActionResult> GetAll([FromQuery] ListRequestDto listRequestDto) { return(GetItemsAsyncInternal(listRequestDto)); }
public async Task <PagedResult <TransactionTypeDto> > GetTransactionTypes(ListRequestDto request) { var result = await _transactionTypeRepository.GetPaged(request); return(result); }
public async Task <PagedResult <CustomerDto> > GetCustomers(ListRequestDto request) { var result = await _customerRepository.GetPaged(request); return(result); }