Exemplo n.º 1
0
        public async Task <ActionResult <List <ListItem> > > ListAsync()
        {
            var owner = Auth.GetUser(User.Claims);

            _logger.LogInformation("Listing data for user {User}", owner);

            var ledgers = await _ledgerService.Get(owner);

            if (ledgers == null || ledgers.Count == 0)
            {
                _logger.LogWarning("Data for user {User} not found", owner);
                return(NotFound());
            }

            return(ledgers.Select(x => {
                return new ListItem()
                {
                    Year = x.Year,
                    Month = x.Month,
                    Type = x.Type
                };
            }).ToList());
        }