public IActionResult Index()
        {
            var viewModel = new ReceiptIndexViewModel();

            viewModel.Receipts = this.dbService.Db().Receipts.Include(r => r.Recipient)
                                 .Where(r => r.Recipient.NormalizedUserName == this.User.Identity.Name.ToUpper())
                                 .Select(r => new BaseReceiptIndexViewModel()
            {
                Recipient = r.Recipient.UserName,
                Fee       = r.Fee,
                Id        = r.Id,
                IssuedOn  = r.IssuedOn.ToString("d"),
            }).ToList();

            return(this.View(viewModel));
        }
Exemple #2
0
        public IActionResult Index()
        {
            var receipts = new ReceiptIndexViewModel
            {
                Receipts = this.receiptService
                           .GetAllByUsername(this.User.Username)
                           .Select(x => new ReceiptViewModel
                {
                    Id            = x.Id,
                    Fee           = x.Fee.ToString("f2"),
                    IssuedOn      = x.IssuedOn.ToString(),
                    RecipientName = x.Recipient.Username
                })
                           .ToList()
            };

            return(this.View(receipts));
        }