public IActionResult GetAllHistory([FromQuery] PaginateQueryDto paginateQuery) { var res = _stockRepository.GetAllHistory(paginateQuery); return(Ok(new PaginateDto <StockHistoryDto> { Data = res.Data.Select(stock => _mapper.Map <StockHistoryDto>(stock)), TotalCount = res.TotalCount })); }
public IActionResult GetAll([FromQuery] PaginateQueryDto paginateQuery) { var res = _customerRepository.GetAll(paginateQuery); return(Ok(new PaginateDto <CustomerDto> { Data = res.Data.Select(customer => _mapper.Map <CustomerDto>(customer)), TotalCount = res.TotalCount })); }
public IActionResult GetAll([FromQuery] PaginateQueryDto paginateQuery) { var res = _productRepository.GetAll(paginateQuery); return(Ok(new PaginateDto <ProductDto> { Data = res.Data.Select(product => _mapper.Map <ProductDto>(product)), TotalCount = res.TotalCount })); }
public PaginateDto <Stock> GetAll(PaginateQueryDto paginateDto) { var res = new PaginateDto <Stock> { Data = _context.Stock .OrderBy(stock => stock.Name) .Skip(paginateDto.Skip) .Take(paginateDto.Take) .ToList() }; if (paginateDto.RequireTotalCount) { res.TotalCount = _context.Stock.Count(); } return(res); }
public PaginateDto <Customer> GetAll(PaginateQueryDto paginateDto) { var res = new PaginateDto <Customer> { Data = _context.Customers .OrderBy(customer => customer.FirstName) .Skip(paginateDto.Skip) .Take(paginateDto.Take) .ToList() }; if (paginateDto.RequireTotalCount) { res.TotalCount = _context.Customers.Count(); } return(res); }
public PaginateDto <Product> GetAll(PaginateQueryDto paginateDto) { var res = new PaginateDto <Product> { Data = _context.Products .OrderBy(product => product.Name) .Skip(paginateDto.Skip) .Take(paginateDto.Take) .ToList() }; if (paginateDto.RequireTotalCount) { res.TotalCount = _context.Products.Count(); } return(res); }
public PaginateDto <StockHistory> GetAllHistory(PaginateQueryDto paginateDto) { var res = new PaginateDto <StockHistory> { Data = _context.StockHistories .OrderByDescending(stock => stock.Created) .Skip(paginateDto.Skip) .Take(paginateDto.Take) .Include(history => history.Product) .ToList() }; if (paginateDto.RequireTotalCount) { res.TotalCount = _context.StockHistories.Count(); } return(res); }
public PaginateDto <CustomerInvoice> GetAll(PaginateQueryDto paginateDto) { var res = new PaginateDto <CustomerInvoice> { Data = _context.CustomerInvoices .OrderByDescending(invoice => invoice.Created) .Skip(paginateDto.Skip) .Take(paginateDto.Take) .Include(invoice => invoice.Customer) .ToList() }; if (paginateDto.RequireTotalCount) { res.TotalCount = _context.CustomerInvoices.Count(); } return(res); }