@using Groceries.Data; @using Microsoft.EntityFrameworkCore; @model Transaction @inject AppDbContext dbContext @{ ViewBag.Title = "New Transaction"; var store = await dbContext.Stores .Where(store => store.Id == Model.StoreId) .Select(store => string.Concat(store.Retailer!.Name, " ", store.Name)) .SingleAsync(); }

New Transaction

@Model.CreatedAt.ToShortDateString() @Model.CreatedAt.ToLongTimeString() – @store

Promotions

New promotion
@foreach (var promotion in Model.Promotions) { }
Name Items Amount
@promotion.Name @promotion.Items.Sum(item => Model.Items.Single(i => i.ItemId == item.Id).Quantity) @((-promotion.Amount).ToString("c")) Edit
Total @Model.Total.ToString("c")
Back