public ActionResult DoLogin(UserDetails user)
 {
     if (ModelState.IsValid)
     {
         UserBusinessLayer bal = new UserBusinessLayer();
         //New code start
         UserStatus status  = bal.GetUserValidity(user);
         bool       IsAdmin = false;
         if (status == UserStatus.AuthenticatedAdmin)
         {
             IsAdmin = true;
         }
         else if (status == UserStatus.AuthenticatedUser)
         {
             IsAdmin = false;
         }
         else
         {
             ModelState.AddModelError("CredentialError", "Invalid Username or password");
             return(View("Login"));
         }
         FormsAuthentication.SetAuthCookie(user.UserName, false);
         Session["IsAdmin"] = IsAdmin;
         return(RedirectToAction("Index", "Admin"));
     }
     else
     {
         return(View("Login"));
     }
 }