merge: bring in feature-netcore-scaffolding-pain
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
commit 34664fc9f3876605001b4c5294d3350a136f2997 Author: surtur <a_mirre@utb.cz> Date: Thu Dec 31 01:18:05 2020 +0100 chore: edit the scaffolded views to use our layout commit 6816006c09b5a3d79c489e3c27d7081b83e6195e Author: surtur <a_mirre@utb.cz> Date: Thu Dec 31 01:14:17 2020 +0100 chore: update Makefile "run" target+added targets * pgdba - start a dev db container in background * pgdbz - stop the dev db image * docker run db img args are configured via variables as seen fit * run is now more of a "watch run" commit f1d87345ac2d7d9ce854a6c8bb37731ff0f8805c Author: surtur <a_mirre@utb.cz> Date: Thu Dec 31 01:12:41 2020 +0100 chore: add {OrderItem,Order} links to navbar commit c214cf4fe6625ad312275432a8883a01e37f9cf0 Author: surtur <a_mirre@utb.cz> Date: Wed Dec 30 13:37:34 2020 +0100 chore: add netcore-scaffolded controllers+views * Templates folder of the vs.web.codegenerators pkg (v3.1.4) had to be temporarily copied to the project directory for the scaffolding to work; unnecessary template folders had to be removed prior to running scaffold command * restored pkgs and clean built, then scaffolded using (var set for trace output of the command): make restore clean build; codegen_trace=1 dotnet-aspnet-codegenerator controller -p "." -actions --force -name OrdersController -dc pwt_0x01_ng.Models.Database.DBContext -async -m pwt_0x01_ng.Models.Order -namespace pwt_0x01_ng.Areas.Admin.Controllers -outDir Areas/Admin/Controllers --no-build make restore clean build; codegen_trace=1 dotnet-aspnet-codegenerator controller -p "." -actions --force -name OrderItemController -dc pwt_0x01_ng.Models.Database.DBContext -async -m pwt_0x01_ng.Models.OrderItem -namespace pwt_0x01_ng.Areas.Admin.Controllers -outDir Areas/Admin/Controllers --no-build
This commit is contained in:
parent
421a8f5f62
commit
df9f0b36c4
|
@ -0,0 +1,167 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using pwt_0x01_ng.Models;
|
||||
using pwt_0x01_ng.Models.Database;
|
||||
|
||||
namespace pwt_0x01_ng.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
public class OrderItemController : Controller
|
||||
{
|
||||
private readonly DBContext _context;
|
||||
|
||||
public OrderItemController(DBContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: Admin/OrderItem
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
var dBContext = _context.OrderItem.Include(o => o.Order).Include(o => o.Product);
|
||||
return View(await dBContext.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Admin/OrderItem/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var orderItem = await _context.OrderItem
|
||||
.Include(o => o.Order)
|
||||
.Include(o => o.Product)
|
||||
.FirstOrDefaultAsync(m => m.id == id);
|
||||
if (orderItem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(orderItem);
|
||||
}
|
||||
|
||||
// GET: Admin/OrderItem/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
ViewData["Order_id"] = new SelectList(_context.Order, "id", "Order_Number");
|
||||
ViewData["Product_id"] = new SelectList(_context.Product, "id", "Description");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Admin/OrderItem/Create
|
||||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
||||
// more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create([Bind("Order_id,Product_id,Amount,Price,id,Created,Updated")] OrderItem orderItem)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Add(orderItem);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
ViewData["Order_id"] = new SelectList(_context.Order, "id", "Order_Number", orderItem.Order_id);
|
||||
ViewData["Product_id"] = new SelectList(_context.Product, "id", "Description", orderItem.Product_id);
|
||||
return View(orderItem);
|
||||
}
|
||||
|
||||
// GET: Admin/OrderItem/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var orderItem = await _context.OrderItem.FindAsync(id);
|
||||
if (orderItem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
ViewData["Order_id"] = new SelectList(_context.Order, "id", "Order_Number", orderItem.Order_id);
|
||||
ViewData["Product_id"] = new SelectList(_context.Product, "id", "Description", orderItem.Product_id);
|
||||
return View(orderItem);
|
||||
}
|
||||
|
||||
// POST: Admin/OrderItem/Edit/5
|
||||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
||||
// more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(int id, [Bind("Order_id,Product_id,Amount,Price,id,Created,Updated")] OrderItem orderItem)
|
||||
{
|
||||
if (id != orderItem.id)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
_context.Update(orderItem);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!OrderItemExists(orderItem.id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
ViewData["Order_id"] = new SelectList(_context.Order, "id", "Order_Number", orderItem.Order_id);
|
||||
ViewData["Product_id"] = new SelectList(_context.Product, "id", "Description", orderItem.Product_id);
|
||||
return View(orderItem);
|
||||
}
|
||||
|
||||
// GET: Admin/OrderItem/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var orderItem = await _context.OrderItem
|
||||
.Include(o => o.Order)
|
||||
.Include(o => o.Product)
|
||||
.FirstOrDefaultAsync(m => m.id == id);
|
||||
if (orderItem == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(orderItem);
|
||||
}
|
||||
|
||||
// POST: Admin/OrderItem/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
var orderItem = await _context.OrderItem.FindAsync(id);
|
||||
_context.OrderItem.Remove(orderItem);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
private bool OrderItemExists(int id)
|
||||
{
|
||||
return _context.OrderItem.Any(e => e.id == id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Rendering;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using pwt_0x01_ng.Models;
|
||||
using pwt_0x01_ng.Models.Database;
|
||||
|
||||
namespace pwt_0x01_ng.Areas.Admin.Controllers
|
||||
{
|
||||
[Area("Admin")]
|
||||
public class OrdersController : Controller
|
||||
{
|
||||
private readonly DBContext _context;
|
||||
|
||||
public OrdersController(DBContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// GET: Admin/Orders
|
||||
public async Task<IActionResult> Index()
|
||||
{
|
||||
return View(await _context.Order.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Admin/Orders/Details/5
|
||||
public async Task<IActionResult> Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var order = await _context.Order
|
||||
.FirstOrDefaultAsync(m => m.id == id);
|
||||
if (order == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// GET: Admin/Orders/Create
|
||||
public IActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Admin/Orders/Create
|
||||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
||||
// more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Create([Bind("Order_Number,id,Created,Updated")] Order order)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
_context.Add(order);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// GET: Admin/Orders/Edit/5
|
||||
public async Task<IActionResult> Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var order = await _context.Order.FindAsync(id);
|
||||
if (order == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// POST: Admin/Orders/Edit/5
|
||||
// To protect from overposting attacks, enable the specific properties you want to bind to, for
|
||||
// more details, see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> Edit(int id, [Bind("Order_Number,id,Created,Updated")] Order order)
|
||||
{
|
||||
if (id != order.id)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
try
|
||||
{
|
||||
_context.Update(order);
|
||||
await _context.SaveChangesAsync();
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!OrderExists(order.id))
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// GET: Admin/Orders/Delete/5
|
||||
public async Task<IActionResult> Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var order = await _context.Order
|
||||
.FirstOrDefaultAsync(m => m.id == id);
|
||||
if (order == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
return View(order);
|
||||
}
|
||||
|
||||
// POST: Admin/Orders/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<IActionResult> DeleteConfirmed(int id)
|
||||
{
|
||||
var order = await _context.Order.FindAsync(id);
|
||||
_context.Order.Remove(order);
|
||||
await _context.SaveChangesAsync();
|
||||
return RedirectToAction(nameof(Index));
|
||||
}
|
||||
|
||||
private bool OrderExists(int id)
|
||||
{
|
||||
return _context.Order.Any(e => e.id == id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
@model pwt_0x01_ng.Models.OrderItem
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<h4>OrderItem</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Order_id" class="control-label"></label>
|
||||
<select asp-for="Order_id" class ="form-control" asp-items="ViewBag.Order_id"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Product_id" class="control-label"></label>
|
||||
<select asp-for="Product_id" class ="form-control" asp-items="ViewBag.Product_id"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Amount" class="control-label"></label>
|
||||
<input asp-for="Amount" class="form-control" />
|
||||
<span asp-validation-for="Amount" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Price" class="control-label"></label>
|
||||
<input asp-for="Price" class="form-control" />
|
||||
<span asp-validation-for="Price" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
|
@ -0,0 +1,57 @@
|
|||
@model pwt_0x01_ng.Models.OrderItem
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>OrderItem</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Amount)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Amount)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Price)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Price)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Order)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Order.Order_Number)
|
||||
</dd class>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Product)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Product.Description)
|
||||
</dd class>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Created)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Created)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Updated)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Updated)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form asp-action="Delete">
|
||||
<input type="hidden" asp-for="id" />
|
||||
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,54 @@
|
|||
@model pwt_0x01_ng.Models.OrderItem
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<div>
|
||||
<h4>OrderItem</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Amount)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Amount)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Price)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Price)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Order)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Order.Order_Number)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Product)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Product.Description)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Created)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Created)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Updated)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Updated)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Edit" asp-route-id="@Model.id">Edit</a> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
|
@ -0,0 +1,55 @@
|
|||
@model pwt_0x01_ng.Models.OrderItem
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<h4>OrderItem</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Edit">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Order_id" class="control-label"></label>
|
||||
<select asp-for="Order_id" class="form-control" asp-items="ViewBag.Order_id"></select>
|
||||
<span asp-validation-for="Order_id" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Product_id" class="control-label"></label>
|
||||
<select asp-for="Product_id" class="form-control" asp-items="ViewBag.Product_id"></select>
|
||||
<span asp-validation-for="Product_id" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Amount" class="control-label"></label>
|
||||
<input asp-for="Amount" class="form-control" />
|
||||
<span asp-validation-for="Amount" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Price" class="control-label"></label>
|
||||
<input asp-for="Price" class="form-control" />
|
||||
<span asp-validation-for="Price" class="text-danger"></span>
|
||||
</div>
|
||||
<input type="hidden" asp-for="id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Created" class="control-label"></label>
|
||||
<input asp-for="Created" class="form-control" />
|
||||
<span asp-validation-for="Created" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Updated" class="control-label"></label>
|
||||
<input asp-for="Updated" class="form-control" />
|
||||
<span asp-validation-for="Updated" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Save" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
|
@ -0,0 +1,65 @@
|
|||
@model IEnumerable<pwt_0x01_ng.Models.OrderItem>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "OrderItem";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<p>
|
||||
<a asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Amount)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Price)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Order)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Product)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Created)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Updated)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Amount)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Price)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Order.Order_Number)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Product.Description)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Created)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Updated)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.id">Edit</a> |
|
||||
<a asp-action="Details" asp-route-id="@item.id">Details</a> |
|
||||
<a asp-action="Delete" asp-route-id="@item.id">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
|
@ -0,0 +1,29 @@
|
|||
@model pwt_0x01_ng.Models.Order
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<h4>Order</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Create">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Order_Number" class="control-label"></label>
|
||||
<input asp-for="Order_Number" class="form-control" />
|
||||
<span asp-validation-for="Order_Number" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
|
@ -0,0 +1,39 @@
|
|||
@model pwt_0x01_ng.Models.Order
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>Order</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Order_Number)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Order_Number)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Created)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Created)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Updated)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Updated)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form asp-action="Delete">
|
||||
<input type="hidden" asp-for="id" />
|
||||
<input type="submit" value="Delete" class="btn btn-danger" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</form>
|
||||
</div>
|
|
@ -0,0 +1,36 @@
|
|||
@model pwt_0x01_ng.Models.Order
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<div>
|
||||
<h4>Order</h4>
|
||||
<hr />
|
||||
<dl class="row">
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Order_Number)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Order_Number)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Created)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Created)
|
||||
</dd>
|
||||
<dt class = "col-sm-2">
|
||||
@Html.DisplayNameFor(model => model.Updated)
|
||||
</dt>
|
||||
<dd class = "col-sm-10">
|
||||
@Html.DisplayFor(model => model.Updated)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Edit" asp-route-id="@Model.id">Edit</a> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
|
@ -0,0 +1,40 @@
|
|||
@model pwt_0x01_ng.Models.Order
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<h4>Order</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form asp-action="Edit">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Order_Number" class="control-label"></label>
|
||||
<input asp-for="Order_Number" class="form-control" />
|
||||
<span asp-validation-for="Order_Number" class="text-danger"></span>
|
||||
</div>
|
||||
<input type="hidden" asp-for="id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Created" class="control-label"></label>
|
||||
<input asp-for="Created" class="form-control" />
|
||||
<span asp-validation-for="Created" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Updated" class="control-label"></label>
|
||||
<input asp-for="Updated" class="form-control" />
|
||||
<span asp-validation-for="Updated" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Save" class="btn btn-primary" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
|
@ -0,0 +1,46 @@
|
|||
@model IEnumerable<pwt_0x01_ng.Models.Order>
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
<p>
|
||||
<a asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Order_Number)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Created)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Updated)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Order_Number)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Created)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Updated)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-action="Edit" asp-route-id="@item.id">Edit</a> |
|
||||
<a asp-action="Details" asp-route-id="@item.id">Details</a> |
|
||||
<a asp-action="Delete" asp-route-id="@item.id">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
18
Makefile
18
Makefile
|
@ -14,8 +14,16 @@ dargskaniko = -w=$(wdir) -v $$(pwd):$(wdir) $(kanikoimg)
|
|||
kanikoargs = -c=$(wdir) --use-new-run --snapshotMode=redo --no-push
|
||||
krelease = $(dcmdrun) $(dargskaniko) -f=$(dfile) $(kanikoargs)
|
||||
kdebug = $(dcmdrun) $(dargskaniko) -f=$(dfiledev) $(kanikoargs)
|
||||
pgdbcapdrop = --cap-drop NET_ADMIN --cap-drop SYS_ADMIN
|
||||
pgdbenv = -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=679968312e029a806c1905c40ec331aa199a1eb86bd0b9eb04057933e449bdc9ef8ef292a39b68cafa5689c901a17266 -e POSTGRES_INITDB_ARGS="--data-checksums"
|
||||
pgdbname = pgdb
|
||||
pgdbports = -p 127.0.0.1:5433:5432
|
||||
pgdbvol = -v pgdbdata:/var/lib/postgresql/data
|
||||
pgdbargs = run -d $(pgdbcapdrop) $(pgdbenv) --name $(pgdbname) $(pgdbports) $(pgdbvol) --restart unless-stopped
|
||||
pgdbimg = postgres:13.1-alpine
|
||||
zenv = DB_CONNECTION_STRING=$$(cat appsettings.Development.json | jq .db.Postgres | sed -e 's/5432/5433/' -e 's/=db/=localhost/' -e 's/"//g')
|
||||
|
||||
.PHONY: dev dockerbuild dockerdevbuild dockerrun dockerdevrun dockertest dockerdev kaniko clean prune test
|
||||
.PHONY: dev dockerbuild dockerdevbuild dockerrun dockerdevrun dockertest dockerdev kaniko clean prune pgdba pgdbz test
|
||||
|
||||
dev: restore build run
|
||||
|
||||
|
@ -26,7 +34,7 @@ build:
|
|||
$(CC) build .
|
||||
|
||||
run:
|
||||
$(CC) run .
|
||||
$(zenv) $(CC) watch run .
|
||||
|
||||
releasebuild: restore clean
|
||||
$(CC) publish -c Release
|
||||
|
@ -76,3 +84,9 @@ clean:
|
|||
|
||||
prune:
|
||||
$(dcmd) $(pruneargs)
|
||||
|
||||
pgdba:
|
||||
$(dcmd) $(pgdbargs) $(pgdbimg)
|
||||
|
||||
pgdbz:
|
||||
$(dcmd) stop $(pgdbname)
|
||||
|
|
|
@ -46,6 +46,12 @@
|
|||
<li>
|
||||
<a asp-area="Admin" asp-controller="Product" asp-action="Select">Products</a>
|
||||
</li>
|
||||
<li>
|
||||
<a asp-area="Admin" asp-controller="Orders" asp-action="Index">Orders</a>
|
||||
</li>
|
||||
<li>
|
||||
<a asp-area="Admin" asp-controller="OrderItem" asp-action="Index">OrderItems</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.10" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.10" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.1.10" />
|
||||
</ItemGroup>
|
||||
|
@ -22,6 +24,7 @@
|
|||
<ItemGroup>
|
||||
<Folder Include="Areas\Admin\Data" />
|
||||
<Folder Include="Areas\Admin\Models" />
|
||||
<Folder Include="Areas\Admin\Views" />
|
||||
<Folder Include="Migrations\pgsql" />
|
||||
<Folder Include="Models\Database" />
|
||||
<Folder Include="Models\Database\Conf" />
|
||||
|
|
Reference in New Issue