Exemplo n.º 1
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if (httpContext.Session["user"] != null)
            {
                Data.UserSet user = (Data.UserSet)httpContext.Session["user"];
                if (user.UserTypeSet.Title == "Admin")
                {
                    return(true);
                }
            }

            httpContext.Response.Redirect("Home/Login");
            return(false);
        }
Exemplo n.º 2
0
        public ActionResult Login(string email, string password)
        {
            Data.dbEntities db   = new Data.dbEntities();
            Data.UserSet    user = db.UserSet.FirstOrDefault(r => r.Mail == email && r.Password == password);
            if (user != null)
            {
                Session["user"] = user;
                return(RedirectToAction("Index"));
            }

            TempData["error"] = "Hatalı kullanıcı adı veya parola";

            return(View());
        }
Exemplo n.º 3
0
 protected void BindLoginComboBox()
 {
     Data.UserSet u = Manager.Instance.GetUsers();
     loginComboBox.Items.Add(u.Users);
 }