33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
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 class="form-field">
|
|
@Model.Transaction.CreatedAt.ToShortDateString() @Model.Transaction.CreatedAt.ToShortTimeString() – @store
|
|
</div>
|
|
|
|
<form id="editTransactionItem" method="post" asp-action="EditTransactionItem">
|
|
<partial name="_TransactionItemForm" model="Model.TransactionItem" />
|
|
</form>
|
|
|
|
<form id="deleteTransactionItem" method="post" asp-action="DeleteTransactionItem" asp-route-id="@Model.TransactionItem.ItemId"></form>
|
|
|
|
<div class="row">
|
|
<button class="button button--primary" type="submit" form="editTransactionItem">Update</button>
|
|
<a class="button" asp-action="NewTransactionItems">Cancel</a>
|
|
<span class="row__fill"></span>
|
|
<button class="button button--danger" type="submit" form="deleteTransactionItem">Remove</button>
|
|
</div>
|