public IHttpResponse Index() { var receipts = this.Db.Receipts.Where(r => r.RecipientId == int.Parse(this.User.Info)).ToList().Select(r => new ReceiptViewModel() { Id = r.Id, Fee = r.Fee, IssuedOn = r.IssuedOn.ToShortDateString(), Recipient = this.User.Username }).ToList(); var model = new ReceiptsIndexViewModel() { Receipts = receipts }; return(this.View(model)); }
public IHttpResponse Index() { var receipts = this.Db.Receipts .Where(r => r.Recipient.Username == this.User.Username) .Select(r => new ReceiptIndexDetailViewModel { Id = r.Id, Fee = r.Fee, IssuedOn = r.IssuedOn.ToString("dd/MM/yyyy"), Recipient = r.Recipient.Username }).ToList(); var view = new ReceiptsIndexViewModel { Receipts = receipts }; return(this.View(view)); }