Add base bundles controller
This commit is contained in:
parent
a27cab1321
commit
9107bb6788
20
Controllers/BundlesController.cs
Normal file
20
Controllers/BundlesController.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using MyDarling.Models;
|
||||||
|
|
||||||
|
namespace MyDarling.Controllers
|
||||||
|
{
|
||||||
|
public class BundlesController : Controller
|
||||||
|
{
|
||||||
|
private IRepository repository;
|
||||||
|
|
||||||
|
public BundlesController(IRepository repository)
|
||||||
|
{
|
||||||
|
this.repository = repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ActionResult Index()
|
||||||
|
{
|
||||||
|
return View(repository);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
Views/Bundles/Index.cshtml
Normal file
38
Views/Bundles/Index.cshtml
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
|
@model MyDarling.Models.IRepository
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>Bundles list</title>
|
||||||
|
<link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<container>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">#</th>
|
||||||
|
<th scope="col">Name</th>
|
||||||
|
<th scope="col">Descrition</th>
|
||||||
|
<th scope="col">Price</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach (var bundle in Model.Bundles)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<th scope="row">@bundle.Id</th>
|
||||||
|
<td>@bundle.Name</td>
|
||||||
|
<td>@bundle.Description</td>
|
||||||
|
<td>@bundle.Price</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</container>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,6 +1,6 @@
|
|||||||
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav">
|
<nav class="navbar navbar-expand-lg navbar-dark fixed-top" id="mainNav">
|
||||||
<div class="container px-4 px-lg-5">
|
<div class="container px-4 px-lg-5">
|
||||||
<a class="navbar-brand" href="#page-top"><img height="40" src="/assets/img/logo.svg"></a>
|
<a class="navbar-brand" href="/Home/Index#page-top"><img height="40" src="/assets/img/logo.svg"></a>
|
||||||
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse"
|
<button class="navbar-toggler navbar-toggler-right" type="button" data-bs-toggle="collapse"
|
||||||
data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false"
|
data-bs-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false"
|
||||||
aria-label="Toggle navigation">
|
aria-label="Toggle navigation">
|
Loading…
Reference in New Issue
Block a user