Exemple #1
0
        public ActionResult UserLogin(LoginDetails data)
        {
            if (data == null || string.IsNullOrEmpty(data.UserName) || string.IsNullOrEmpty(data.Password))
            {
                return(null);
            }

            if (ConfigurationManager.AppSettings["AdminUserName"] == data.UserName && ConfigurationManager.AppSettings["AdminPassword"] == data.Password)
            {
                if (Session["AdminUserName"] == null || Session["AdminPassword"] == null)
                {
                    Session.Add("AdminUserName", data.UserName);
                    Session.Add("AdminPassword", data.Password);
                }

                return(Json(new { result = "Redirect", url = Url.Action("Index", "Home") }));
            }

            return(View());
        }
        public ActionResult UserLogin(LoginDetails data)
        {
            if (data == null || string.IsNullOrEmpty(data.UserName) || string.IsNullOrEmpty(data.Password))
            {
                return null;
            }

            if (ConfigurationManager.AppSettings["AdminUserName"] == data.UserName && ConfigurationManager.AppSettings["AdminPassword"] == data.Password)
            {
                if (Session["AdminUserName"] == null || Session["AdminPassword"] == null)
                {
                    Session.Add("AdminUserName", data.UserName);
                    Session.Add("AdminPassword", data.Password);
                }

                return Json(new { result = "Redirect", url = Url.Action("Index", "Home") });
            }

            return View();
        }