Esempio n. 1
0
        public ActionResult Index()
        {
            Search sd = new Search();
            FlightBookingEntity db = new FlightBookingEntity();
            List <airline>      ob = db.airlines.ToList();

            return(View(sd));
        }
Esempio n. 2
0
        public ActionResult signUp(customer_book customerModel1)
        {
            Session["useremail"] = customerModel1.customer_emailaddress;
            using (FlightBookingEntity db = new FlightBookingEntity())
            {
                db.customer_book.Add(customerModel1);
                db.SaveChanges();
            }
            ModelState.Clear();
            ViewData["message"] = "Successfully signed up.Go to Login Page!";
            customerModel1      = null;


            return(View("signUp", new customer_book()));
        }
Esempio n. 3
0
        public ActionResult ForgotPasswordView(customer_book customerModel)
        {
            String        connetionString = System.Configuration.ConfigurationManager.ConnectionStrings["FlightBookingEntity"].ConnectionString;
            SqlConnection connection      = new SqlConnection(connetionString);

            FlightBookingEntity db = new FlightBookingEntity();
            var    customerid      = db.customer_book.Where(x => x.customer_emailaddress == customerModel.customer_emailaddress).Select(x => x.customer_id).FirstOrDefault();
            String sqlPattern      = @"update customer_book set customer_password="******"where customer_id=" + customerid;
            String sqlSentence     = String.Format(sqlPattern);

            connection.Open();
            SqlCommand command = new SqlCommand(sqlSentence, connection);

            command.ExecuteNonQuery();
            ViewData["message"] = "Password updated successfully.";
            return(View());
        }
Esempio n. 4
0
        public ActionResult Login(customer_book customerModel)
        {
            using (FlightBookingEntity db = new FlightBookingEntity())
            {
                var obj = db.customer_book.Where(x => x.customer_emailaddress == customerModel.customer_emailaddress && x.customer_password == customerModel.customer_password).FirstOrDefault();
                if (obj == null)
                {
                    customerModel.LoginErrorMessage = "Please enter valid Username or Password";
                    return(View("Login", customerModel));
                }


                Session["username"] = obj.customer_name;
                Session["userId"]   = obj.customer_id;

                return(RedirectToAction("Index"));
            }
        }