public ActionResult Save(HiringManager hiringManager)
        {
            var allHM = _context.HiringManagers.ToList();

            for (int i = 0; i < allHM.Count(); i++)
            {
                if (allHM.ElementAt(i).Email.Equals(hiringManager.Email) == true)
                {
                    return(View("EmailExisted"));
                }
            }

            // check the code for hiring manager
            if (hiringManager.Code == Codes.secretCode)
            {
                hiringManager.Privilege = 2;
                _context.HiringManagers.Add(hiringManager);

                _context.SaveChanges();
                Session["logined"] = true;

                Session["userName"]      = hiringManager.Name;
                Session["userPrivilege"] = hiringManager.Privilege;

                var hmid = _context.HiringManagers.ToList().Last().Id;
                Session["id"] = hmid;
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("SignUpHiringManager", "UserAccount"));
            }
        }
        // login check for hiring manager
        public ActionResult Check(HiringManager hiringManager)
        {
            var hiringManagers = _context.HiringManagers.ToList();
            var inputEmail     = hiringManager.Email;
            var inputPassword  = hiringManager.Password;

            foreach (var hm in hiringManagers)
            {
                if (hm.Email.Equals(inputEmail) && hm.Password.Equals(inputPassword))
                {
                    Session["logined"]       = true;
                    Session["id"]            = hm.Id;
                    Session["userName"]      = hm.Name;
                    Session["userPrivilege"] = hm.Privilege;
                    return(RedirectToAction("Index", "Home"));
                }
            }
            return(RedirectToAction("SignIn", "UserAccount"));
        }
        public IActionResult HiringManagerSignup(HiringManager hiringManager)
        {
            try{
                var hiringmanager_one = _database.hiringManagers.Where(value => value.Email == hiringManager.Email).FirstOrDefault();

                if (hiringmanager_one == null)
                {
                    _database.hiringManagers.Add(hiringManager);
                    _database.SaveChanges();

                    //        var userIdentity = new ClaimsIdentity(new[] {

                    //     new Claim(ClaimTypes.Name , hiringManager.Email)

                    // } , CookieAuthenticationDefaults.AuthenticationScheme);

                    // var principal = new ClaimsPrincipal(userIdentity);

                    // var login = HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme , principal);
                    addAuthentication(hiringManager.Email);
                    Alert(NotificationType.success, "You have successfully Registered  as Hiring Manager", "Registerd!");

                    return(RedirectToAction("HiringIndex", "HiringManager", new { userEmailAdress = hiringManager.Email.ToString() }));
                }
                else
                {
                    Alert(NotificationType.info, "The user  has already registered!", "Sorry!");

                    return(RedirectToAction("HiringManagerSignup", "HiringManager"));
                }
            }catch (Exception ex) {
                Console.Write($"Error : {ex.Message}");
            }


            return(View(hiringManager));
        }
 void Awake()
 {
     Instance = this;
 }