mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add controller for computers.
This commit is contained in:
22
cicm_web/Controllers/ComputerController.cs
Normal file
22
cicm_web/Controllers/ComputerController.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user