using FoodShop.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace FoodShop.Controllers
{
    [Authorize(Roles = "Admin,PowerUser")]
    public class AdminController : Controller
    {
        private readonly ApplicationDbContext _context;

        public AdminController(ApplicationDbContext context)
        {
            _context = context;
        }

        public IActionResult Index()
        {
            ViewBag.Uno = _context.Users.Count();
            ViewBag.Due = _context.Roles.Count();
            ViewBag.Tre = _context.Banners.Count();
            ViewBag.Quattro = _context.Notizias.Count();
            ViewBag.Cinque = _context.Countries.Count();
            //ViewBag.Sei = _context..Count();
            //ViewBag.Sette = _context..Count();
            //ViewBag.Otto = _context..Count();

            ViewBag.UnoTitle = "Users";
            ViewBag.DueTitle = "Roles";
            ViewBag.TreTitle = "Banners";
            ViewBag.QuattroTitle = "News";
            ViewBag.CinqueTitle = "Countries";
            ViewBag.SeiTitle = "";
            ViewBag.SetteTitle = "";
            ViewBag.OttoTitle = "";

            return View();
        }
    }
}
