groceries/Groceries/Transactions/EditTransactionItem.cshtml
2023-07-23 20:00:53 +01:00

27 lines
891 B
Plaintext

@using Groceries.Data;
@using Microsoft.EntityFrameworkCore;
@model (Transaction Transaction, TransactionItem TransactionItem)
@inject AppDbContext dbContext
@{
ViewBag.Title = "Edit Transaction Item";
var store = await dbContext.Stores
.Where(store => store.Id == Model.Transaction.StoreId)
.Select(store => string.Concat(store.Retailer!.Name, " ", store.Name))
.SingleAsync();
}
<h1>Edit Transaction Item</h1>
<div>@Model.Transaction.CreatedAt.ToShortDateString() @Model.Transaction.CreatedAt.ToShortTimeString() &ndash; @store</div>
<form method="post" asp-action="EditTransactionItem">
<partial name="_TransactionItemForm" model="Model.TransactionItem" />
<div class="row">
<button class="button button--primary" type="submit">Update</button>
<a class="button" asp-action="EditTransactionItems">Cancel</a>
</div>
</form>