Пример #1
0
        private bool ValidateUser(string userName, string password)
        {
            bool isValid = false;

            using (var db = new CarRentalSystemDBEntities5())
            {
                var user = db.Customers.FirstOrDefault(u => u.Username == userName);
                if (user != null)
                {
                    if (user.Password == password)
                    {
                        Session["Customer_Id"] = user.Customer_Id;
                        Session["FirstName"]   = user.FirstName;
                        Session["LastName"]    = user.LastName;
                        Session["UserName"]    = user.Username;
                        Session["Email"]       = user.Email;
                        Session["Phonenumber"] = user.Phonenumber;

                        isValid = true;
                    }
                }
            }
            return(isValid);
        }