Beispiel #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            customer_book customer_book = await db.customer_book.FindAsync(id);

            db.customer_book.Remove(customer_book);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Beispiel #2
0
        public async Task <ActionResult> Edit([Bind(Include = "customer_id,country,Gender,customer_name,birth_Date,customer_address,customer_phonenumber,customer_emailaddress,customer_postalcode,customer_password")] customer_book customer_book)
        {
            if (ModelState.IsValid)
            {
                db.Entry(customer_book).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(customer_book));
        }
Beispiel #3
0
        // GET: customer_book/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            customer_book customer_book = await db.customer_book.FindAsync(id);

            if (customer_book == null)
            {
                return(HttpNotFound());
            }
            return(View(customer_book));
        }
Beispiel #4
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()));
        }
Beispiel #5
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());
        }
Beispiel #6
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"));
            }
        }