v1.0.0: Controllers — Admin, Slides, Devices, Display, API
This commit is contained in:
@@ -0,0 +1,26 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NoticeBoard.Data;
|
||||||
|
|
||||||
|
namespace NoticeBoard.Controllers;
|
||||||
|
|
||||||
|
public class AdminController : Controller
|
||||||
|
{
|
||||||
|
private readonly AppDbContext _db;
|
||||||
|
|
||||||
|
public AdminController(AppDbContext db)
|
||||||
|
{
|
||||||
|
_db = db;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IActionResult> Index()
|
||||||
|
{
|
||||||
|
ViewBag.SlideCount = await _db.Slides.CountAsync();
|
||||||
|
ViewBag.DeviceCount = await _db.Devices.CountAsync();
|
||||||
|
ViewBag.Devices = await _db.Devices
|
||||||
|
.Include(d => d.DeviceSlides)
|
||||||
|
.OrderBy(d => d.Name)
|
||||||
|
.ToListAsync();
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user