Add good list

This commit is contained in:
Sakurai Ryota 2025-02-09 11:14:06 +09:00
parent e4d1ba38df
commit 50af377bf2
3 changed files with 65 additions and 27 deletions

View File

@ -13,7 +13,15 @@ public class GoodsController : Controller
this.repository = repository;
}
public IActionResult Index()
public async Task<IActionResult> Index()
{
int offset = 0;
int count = 100;
var ret = await this.repository.GetGoods(offset, count).ConfigureAwait(false);
return View(ret);
}
public IActionResult Register()
{
return View();
}

View File

@ -1,32 +1,32 @@
@model List<Uriagekun.Lib.Data.GoodData>
@{
ViewData["Title"] = "商品管理";
}
<div class="container-fluid row">
<div class="col-md-6">
<h2>商品登録</h2>
<form method="post" asp-action="Add" asp-controller="Goods">
<div class="form-group row m-2">
<div class="col-md-3">
<label class="form-label" for="goodLabel">商品名</label>
</div>
<div class="col-md-9">
<input type="text" minlength="0" maxlength="40" required name="Label" class="form-control" id="goodLabel" />
</div>
</div>
<div class="form-group row m-2">
<div class="col-md-3">
<label class="form-label" for="goodBarcode">バーコード</label>
</div>
<div class="col-md-9">
<input type="text" minlength="0" maxlength="16" required name="Barcode" class="form-control" id="goodBarcode" />
</div>
</div>
<div class="form-group row m-2">
<div class="col-md-9 offset-md-3">
<button type="submit" class="btn btn-block btn-outline-primary">登録</button>
</div>
</div>
</form>
<div class="container-fluid">
<h2>商品管理</h2>
<div class="table-responsive">
<table class="table table-bordered table-stripped">
<thead>
<tr>
<th>商品ID</th>
<th>商品名</th>
<th>バーコード</th>
<th>売上確認</th>
</tr>
</thead>
<tbody>
@foreach(var data in Model) {
<tr>
<td>@(data.Id)</td>
<td>@(data.Label)</td>
<td>@(data.Barcode)</td>
<td>
<a href="~/Good/View/@(data.Barcode)">売上確認ページ</a>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>

View File

@ -0,0 +1,30 @@
@{
ViewData["Title"] = "商品登録";
}
<div class="container-fluid">
<h2>商品登録</h2>
<form method="post" asp-action="Add" asp-controller="Goods">
<div class="form-group row m-2">
<div class="col-md-3">
<label class="form-label" for="goodLabel">商品名</label>
</div>
<div class="col-md-9">
<input type="text" minlength="0" maxlength="40" required name="Label" class="form-control" id="goodLabel" />
</div>
</div>
<div class="form-group row m-2">
<div class="col-md-3">
<label class="form-label" for="goodBarcode">バーコード</label>
</div>
<div class="col-md-9">
<input type="text" minlength="0" maxlength="16" required name="Barcode" class="form-control" id="goodBarcode" />
</div>
</div>
<div class="form-group row m-2">
<div class="col-md-9 offset-md-3">
<button type="submit" class="btn btn-block btn-outline-primary">登録</button>
</div>
</div>
</form>
</div>