예제 #1
0
        public List <Models.LogInBO> getUsers()
        {
            List <Models.LogInBO> l = new List <Models.LogInBO>();
            SqlConnection         SecurityDBConnStr = Models.Connection.getConnection();
            string     s   = "Select * from SignUp ";
            SqlCommand cmd = new SqlCommand(s, SecurityDBConnStr);

            da = new SqlDataAdapter(cmd);
            dt = new DataTable();
            Models.LogInBO u = new Models.LogInBO();
            try
            {
                da.Fill(dt);
                foreach (DataRow d in dt.Rows)
                {
                    u = new Models.LogInBO();
                    u.setemail(d["Email"].ToString());
                    u.setpass(d["Password"].ToString());
                    l.Add(u);
                }
            }
            catch (Exception em)
            {
                return(l);
            }
            return(l);
        }
예제 #2
0
        public ActionResult LogIn(string e, string p)
        {
            Models.LogInBO l = new Models.LogInBO();
            l.setemail(e.Trim());
            l.setpass(p.Trim());
            if (l.getemail() == "Admin")
            {
                return(Redirect("~/Admin/AdminIndex"));
            }
            if (Models.LogInDAL.validateUser(l))
            {
                Session["logIn"] = e.Trim();
                if (l.getemail() == "Admin")
                {
                    return(Redirect("~/Admin/AdminIndex"));
                }
                return(Redirect("~/Home/Index1"));
            }

            return(View());
        }