Exemplo n.º 1
0
        public ActionResult Delete()
        {
            // Create New Objects.
            DBStuff    dal    = new DBStuff();
            Login      myUser = new Login();
            LoginUsers logU   = new LoginUsers();

            // The list of Orders from Db.
            List <Login> objCars = dal.CustomersLog.ToList <Login>();

            // Id Customer to delete the order.
            myUser.ID = Request.Form["GetIDtext2"].ToString();

            // find the product we are looking for by ProductId.
            foreach (Login ob in objCars)
            {
                if (myUser.ID == ob.ID)
                {
                    // remove the product we want form the list.
                    dal.CustomersLog.Remove(ob);
                    dal.SaveChanges();
                }
            }
            return(View("DeleteOrder"));
        }
Exemplo n.º 2
0
        public ActionResult UpdateOrder()
        {
            LoginUsers log      = new LoginUsers();
            Login      ObjOrder = new Login();
            DBStuff    dal      = new DBStuff();

            ObjOrder.ID        = Request.Form["GetIDtext"].ToString();
            ObjOrder.StartDate = Request.Form["startDate1"].ToString();
            ObjOrder.EndDate   = Request.Form["endDate1"].ToString();
            ObjOrder.CarSelect = "none";

            Login np1 =
                (from x in dal.CustomersLog
                 where x.ID == ObjOrder.ID
                 select x).ToList <Login>()[0];

            if (ModelState.IsValid)
            {
                np1.StartDate = ObjOrder.StartDate;
                np1.EndDate   = ObjOrder.EndDate;
                dal.SaveChanges();
            }
            ObjOrder = np1;
            return(RedirectToAction("SelectVehicle", ObjOrder));
        }
Exemplo n.º 3
0
        public ActionResult AddUser()
        {
            DBStuff        dal        = new DBStuff();
            MyOrder        myUser     = new MyOrder();
            List <MyOrder> objOrdersI = dal.OrdersLog.ToList <MyOrder>();

            // Take the values from the TextBox of the user.
            myUser.Username = Request.Form["order.Username"].ToString();
            myUser.Password = Request.Form["order.Password"].ToString();

            if (ModelState.IsValid)
            {
                // check if the username and the password are in the DB.
                foreach (MyOrder ob1 in objOrdersI)
                {
                    // if they are in the Db go to OrdersPage
                    if (myUser.Password != ob1.Password)
                    {
                        // Save in the DB
                        dal.OrdersLog.Add(myUser);
                        dal.SaveChanges();
                        TempData["User"] = myUser;
                        return(RedirectToAction("NewCarOrder", TempData["User"]));
                    }
                }
            }
            return(View("NewOrderUser"));
        }
Exemplo n.º 4
0
        public ActionResult OrderComplete()
        {
            DBStuff     dal      = new DBStuff();
            List <Cars> objCars  = dal.CarsLog.ToList <Cars>();
            CarsInStock mcar     = new CarsInStock();
            Login       ObjOrder = new Login();

            if (TempData.ContainsKey("Student"))
            {
                //If so access it here
                ObjOrder = TempData["Student"] as Login;

                //find Button clicked.
                foreach (Cars ob1 in objCars)
                {
                    if (Request.Form[ob1.CarID] != null)
                    {
                        Login np1 =
                            (from x in dal.CustomersLog
                             where x.ID == ObjOrder.ID
                             select x).ToList <Login>()[0];

                        ObjOrder.CarSelect = ob1.CarType;
                        np1.CarSelect      = ob1.CarType;
                        dal.SaveChanges();
                    }
                }
            }
            return(View());
        }
Exemplo n.º 5
0
        public ActionResult SubmitOrder()
        {
            LoginUsers log      = new LoginUsers();
            Login      ObjOrder = new Login();

            ObjOrder.Visa      = Request.Form["user.Visa"].ToString();
            ObjOrder.ID        = Request.Form["user.OrderID2"].ToString();
            ObjOrder.OrderID   = Request.Form["user.OrderID"].ToString();
            ObjOrder.StartDate = Request.Form["startDate1"].ToString();
            ObjOrder.EndDate   = Request.Form["endDate1"].ToString();
            ObjOrder.CarSelect = "none";

            if (ModelState.IsValid)
            {
                DBStuff dal = new DBStuff();

                // Save in the DB
                dal.CustomersLog.Add(ObjOrder);
                dal.SaveChanges();
                return(RedirectToAction("SelectVehicle", ObjOrder));
            }
            return(View("NewCarOrder"));
        }