Started to implement the frontend
This commit is contained in:
1 parent
9ad1d509df
commit
3cf5a889a7
7 files changed
+24
-21
No files matched your search
+8
-4
@@ -1,21 +1,25 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using RobotsWantedLeague.Models;
|
using RobotsWantedLeague.Models;
|
||||||
|
using RobotsWantedLeague.Services;
|
||||||
|
|
||||||
namespace RobotsWantedLeague.Controllers;
|
namespace RobotsWantedLeague.Controllers;
|
||||||
|
|
||||||
public class HomeController : Controller
|
public class RobotsController : Controller
|
||||||
{
|
{
|
||||||
private readonly ILogger<HomeController> _logger;
|
private readonly ILogger<RobotsController> _logger;
|
||||||
|
private readonly IRobotsService robotsService;
|
||||||
|
|
||||||
public HomeController(ILogger<HomeController> logger)
|
public RobotsController(ILogger<RobotsController> logger,
|
||||||
|
IRobotsService robotsService)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
this.robotsService = robotsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
{
|
{
|
||||||
return View();
|
return View(robotsService.Robots);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Privacy()
|
public IActionResult Privacy()
|
||||||
@@ -24,6 +24,6 @@ app.UseAuthorization();
|
|||||||
|
|
||||||
app.MapControllerRoute(
|
app.MapControllerRoute(
|
||||||
name: "default",
|
name: "default",
|
||||||
pattern: "{controller=Home}/{action=Index}/{id?}");
|
pattern: "{controller=Robots}/{action=Index}/{id?}");
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
@{
|
|
||||||
ViewData["Title"] = "Home Page";
|
|
||||||
}
|
|
||||||
|
|
||||||
<div class="text-center">
|
|
||||||
<h1 class="display-4">Welcome</h1>
|
|
||||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
|
||||||
</div>
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
@{
|
||||||
|
ViewData["Title"] = "Home Page";
|
||||||
|
}
|
||||||
|
@model List<Robot>
|
||||||
|
|
||||||
|
|
||||||
|
<ul class="list-group">
|
||||||
|
@foreach (Robot robot in Model){
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a href="robots/robot?id=@robot.Id">@robot.Name</a>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
File renamed without changes.
@@ -18,14 +18,7 @@
|
|||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||||
<ul class="navbar-nav flex-grow-1">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
@using RobotsWantedLeague
|
@using RobotsWantedLeague
|
||||||
@using RobotsWantedLeague.Models
|
@using RobotsWantedLeague.Models
|
||||||
|
|
||||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||||
Reference in new issue
Block a user