using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Petrol_Bunk.Models;

namespace Petrol_Bunk.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult Login_Post(string LoginId = "", string Password = "")
        {
            Petrol_BunkEntities ctx = new Petrol_BunkEntities();
            var getdata = ctx.TblAdmins.Where(x => x.LoginId == LoginId && x.Password == Password).FirstOrDefault();
            if (getdata != null)
            {
                return new RedirectResult("/Admin/ManageEmployee/AddEmployee");
            }
            else
            {
                TempData["UserMsg"] = "Invalid Login";
                return new RedirectResult("/Home/Index");
            }
        }
        public ActionResult Logout()
        {
            return new RedirectResult("/");
        }
    }
}