using Core_Grid_CRUD.Models;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Globalization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Core_Grid_CRUD.Controllers
{

    public class HomeController : Controller
    {
        public enum MyEnum { Value0=1, Value1=2, Value2=3, Value3=4 };
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            CultureInfo.DefaultThreadCurrentCulture = CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo("en-US");

            base.OnActionExecuting(context);
        }
        public IActionResult Index()
        {
            ViewData["user"] = new UserModel()
            {
                Id =1,
                UserName = "John Doe",
                Admin = new Random().Next(2) == 0
            };
            var user = new UserModel()
            {
                Id = 1,
                UserName = "John Doe",
                Admin = new Random().Next(2) == 0
            };

            return View(user);
        }

        public IActionResult PopEditor()
        {
            var model = new UserModel()
            {
                Id = 1,
                UserName = "John Doe",
                Admin = new Random().Next(2) == 0
            };
            return View(model);
        }
        public IActionResult About()
        {
            ViewData["Message"] = "Your application description page.";

            return View();
        }

        public IActionResult Contact()
        {
            ViewData["Message"] = "Your contact page.";

            return View();
        }

        public IActionResult Error()
        {
            return View();
        }
    }
}
