コード例 #1
0
        public ActionResult LoginD(DeliverLogin log)
        {
            var testConnection = DeliverLoginManager.IsUserValid(log.Email, log.Password);

            if (testConnection != 0)
            {
                HttpContext.Session.SetInt32("idDeliver", testConnection);
                return(RedirectToAction("GetAllOrdersDeliver", "Order"));
            }
            else
            {
                ViewData["MessageError"] = "Email or Password incorrect, try again";
                return(View());
            }
        }
コード例 #2
0
ファイル: DeliverLoginsDB.cs プロジェクト: Luysky/ValaisEat
        public List <DeliverLogin> GetDeliverLogins()
        {
            List <DeliverLogin> results = null;


            try
            {
                using (SqlConnection cn = new SqlConnection(connectionString))
                {
                    string     query = "SELECT * FROM DeliverLogin";
                    SqlCommand cmd   = new SqlCommand(query, cn);

                    cn.Open();

                    using (SqlDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            if (results == null)
                            {
                                results = new List <DeliverLogin>();
                            }

                            DeliverLogin logins = new DeliverLogin();

                            logins.IdLogin   = (int)dr["IdLogin"];
                            logins.IdDeliver = (int)dr["IdDeliver"];
                            logins.Email     = (string)dr["Email"];
                            logins.Password  = (string)dr["Password"];



                            results.Add(logins);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(results);
        }