示例#1
0
        public async Task <IActionResult> GetLogs(int pageNumber, int pageSize)
        {
            if (pageSize <= 0)
            {
                pageSize = 10;
            }
            if (pageNumber <= 0)
            {
                pageNumber = 1;
            }

            var logsFromRepo = await _repo.GetLogs(pageNumber, pageSize);

            var logsToReturn = new {
                TotalCount = _repo.GetTotalLogCount(),
                TotalPages = Math.Ceiling((double)logsFromRepo.Count() / pageSize),
                Logs       = logsFromRepo
            };

            return(Ok(logsToReturn));
        }