From dc48690f3e92d5d27de6f1784147127374bf8995 Mon Sep 17 00:00:00 2001 From: Sakurai Date: Sun, 9 Feb 2025 11:18:49 +0900 Subject: [PATCH] Add good list --- Uriagekun/Controllers/GoodController.cs | 4 ++-- Uriagekun/Views/Good/View.cshtml | 30 +++++++++++++++++++++++++ Uriagekun/Views/Shared/_Layout.cshtml | 5 ++++- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 Uriagekun/Views/Good/View.cshtml diff --git a/Uriagekun/Controllers/GoodController.cs b/Uriagekun/Controllers/GoodController.cs index 8115c79..73a5ec9 100644 --- a/Uriagekun/Controllers/GoodController.cs +++ b/Uriagekun/Controllers/GoodController.cs @@ -21,11 +21,11 @@ public class GoodController : Controller } var good = await this.repository.GetGoodRegisterFromBarcode(id); - if (good is null) + if (good is null || good.Count == 0) { return NotFound(); } - return Json(good); + return View(good); } } diff --git a/Uriagekun/Views/Good/View.cshtml b/Uriagekun/Views/Good/View.cshtml new file mode 100644 index 0000000..497297f --- /dev/null +++ b/Uriagekun/Views/Good/View.cshtml @@ -0,0 +1,30 @@ +@model List +@{ + ViewData["Title"] = $"{Model[0].Label} - 売上管理"; +} + +
+

@(Model[0].Label)

+
+ + + + + + + + + + + @foreach(var data in Model) { + + + + + + + } + +
日時販売個数販売単価純利益
@(data.Date)@(data.Count)@(data.Price)@(data.Count * data.Price)
+
+
diff --git a/Uriagekun/Views/Shared/_Layout.cshtml b/Uriagekun/Views/Shared/_Layout.cshtml index 36728cf..b389eec 100644 --- a/Uriagekun/Views/Shared/_Layout.cshtml +++ b/Uriagekun/Views/Shared/_Layout.cshtml @@ -3,7 +3,7 @@ - @ViewData["Title"] - 売上管理 + @ViewData["Title"] - うりあげくん @@ -25,6 +25,9 @@ +