//public bool IsValidUser(UserDetails user)
 //{
 //    if(user.UserName == "Admin" && user.Password == "Admin")
 //    {
 //        return true;
 //    }
 //    else
 //    {
 //        return false;
 //    }
 //}
 public UserStatus GetUserValidity(UserDetails u)
 {
     if(u.UserName=="Admin" && u.Password=="Admin")
     {
         return UserStatus.AuthenticatedAdmin;
     }
     else if(u.UserName == "Went" && u.Password =="Went")
     {
         return UserStatus.AuthenticatedUser;
     }
     return UserStatus.NonAuthenticatedUser;
 }
        public ActionResult DoLogin(UserDetails u)
        {
            if (ModelState.IsValid)
            {
                EmployeeBusinessLayer bal = new EmployeeBusinessLayer();

                var us = bal.GetUserValidity(u);

                bool IsAdmin = false;
                if(us == UserStatus.AuthenticatedAdmin)
                {
                    IsAdmin = true;
                }
                else if(us == UserStatus.AuthenticatedUser)
                {
                    IsAdmin = false;
                }
                else
                {
                    ModelState.AddModelError("CredentialError", "Invalid Username or Password");
                    return View("Login");
                }

                FormsAuthentication.SetAuthCookie(u.UserName, false);
                Session["IsAdmin"] = IsAdmin;
                return RedirectToAction("Index", "Employee");

                //if (bal.IsValidUser(u))
                //{
                //    FormsAuthentication.SetAuthCookie(u.UserName, false);
                //    return RedirectToAction("Index", "Employee");
                //}
                //else
                //{
                //    ModelState.AddModelError("CredentialError", "Invalid Username or Password");
                //    return View("Login");
                //}
            }
            else
            {
                return View("Login");
            }
        }