Add computer view.

This commit is contained in:
2018-04-14 07:13:11 +01:00
parent 8ddeeeaf4e
commit 0d383a4c65
4 changed files with 589 additions and 11 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using cicm_web.Models;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Computer = Cicm.Database.Schemas.Computer;
@@ -8,6 +9,13 @@ namespace cicm_web.Controllers
{
public class ComputerController : Controller
{
readonly IHostingEnvironment hostingEnvironment;
public ComputerController(IHostingEnvironment env)
{
hostingEnvironment = env;
}
public IActionResult Index()
{
Program.Database.Operations.GetComputers(out List<Computer> computers);
@@ -41,5 +49,12 @@ namespace cicm_web.Controllers
return View(ComputerMini.GetItemsFromYear(id));
}
public IActionResult View(int id)
{
ViewBag.WebRootPath = hostingEnvironment.WebRootPath;
return View(Models.Computer.GetItem(id));
}
}
}