diff --git a/Groceries.Data/Items/Item.cs b/Groceries.Data/Items/Item.cs index ed774da..5ec2e16 100644 --- a/Groceries.Data/Items/Item.cs +++ b/Groceries.Data/Items/Item.cs @@ -16,10 +16,6 @@ public class Item { } - public Item(string brand, string name) : this(default, brand, name) - { - } - public Guid Id { get; init; } public DateTime UpdatedAt { get; set; } public string Brand { get; set; } diff --git a/Groceries.Data/Transactions/TransactionItem.cs b/Groceries.Data/Transactions/TransactionItem.cs index 1aa880b..6b2bb25 100644 --- a/Groceries.Data/Transactions/TransactionItem.cs +++ b/Groceries.Data/Transactions/TransactionItem.cs @@ -22,7 +22,7 @@ public class TransactionItem public decimal Price { get; set; } public int Quantity { get; set; } - public Item? Item { get; init; } + public Item? Item { get; set; } public decimal Amount => Price * Quantity; } diff --git a/Groceries/Transactions/EditTransactionItem.cshtml b/Groceries/Transactions/EditTransactionItem.cshtml index 796c941..2c0153d 100644 --- a/Groceries/Transactions/EditTransactionItem.cshtml +++ b/Groceries/Transactions/EditTransactionItem.cshtml @@ -1,5 +1,5 @@ -@using Groceries.Data; -@using Microsoft.EntityFrameworkCore; +@using Groceries.Data +@using Microsoft.EntityFrameworkCore @model (Transaction Transaction, TransactionItem TransactionItem) @inject AppDbContext dbContext diff --git a/Groceries/Transactions/NewTransactionItem.cshtml b/Groceries/Transactions/NewTransactionItem.cshtml index 10c109b..a32457d 100644 --- a/Groceries/Transactions/NewTransactionItem.cshtml +++ b/Groceries/Transactions/NewTransactionItem.cshtml @@ -1,23 +1,25 @@ -@using Groceries.Data; -@using Microsoft.EntityFrameworkCore; +@using Groceries.Data +@using Microsoft.EntityFrameworkCore -@model Transaction +@model (Transaction Transaction, TransactionItem? TransactionItem) @inject AppDbContext dbContext @{ ViewBag.Title = "New Transaction Item"; var store = await dbContext.Stores - .Where(store => store.Id == Model.StoreId) + .Where(store => store.Id == Model.Transaction.StoreId) .Select(store => string.Concat(store.Retailer!.Name, " ", store.Name)) .SingleAsync(); }