Add controller for computers.

This commit is contained in:
2018-04-14 04:41:04 +01:00
parent e70211e1e3
commit d043ef3333
5 changed files with 370 additions and 6 deletions

View File

@@ -0,0 +1,22 @@
using System.Collections.Generic;
using System.Linq;
using Cicm.Database.Schemas;
using Microsoft.AspNetCore.Mvc;
namespace cicm_web.Controllers
{
public class ComputerController : Controller
{
public IActionResult Index()
{
Program.Database.Operations.GetComputers(out List<Computer> computers);
ViewBag.ItemCount = computers.Count;
ViewBag.MinYear = computers.Where(t => t.Year > 1000).Min(t => t.Year);
ViewBag.MaxYear = computers.Where(t => t.Year > 1000).Max(t => t.Year);
return View();
}
}
}