public ActionResult Details(int id)
        {
            //creation of multiple variables to check conditions and for the display
            IOrderDB               order             = new OrderDB(Configuration);
            IOrderManager          om                = new OrderManager(order);
            ICustomerDB            customer          = new CustomerDB(Configuration);
            ICustomerManager       cm                = new CustomerManager(customer);
            ICityDB                citydb            = new CityDB(Configuration);
            ICityManager           cityman           = new CityManager(citydb);
            IDelivery_staffDB      dsDB              = new Delivery_staffDB(Configuration);
            IDelivery_staffManager dsM               = new Delivery_staffManager(dsDB);
            IDishDB                dish              = new DishDB(Configuration);
            IDishManager           dishManager       = new DishManager(dish);
            IOrder_dishesDB        order_Dishes      = new Order_dishesDB(Configuration);
            IOrder_dishesManager   odm               = new Order_dishesManager(order_Dishes);
            IRestaurantDB          restaurant        = new RestaurantDB(Configuration);
            IRestaurantManager     restaurantManager = new RestaurantManager(restaurant);

            //Creations of multiple ViewData for the display
            var customerlist = cm.GetCustomers();

            ViewData["Customers"] = customerlist;
            var citylist = cityman.GetCities();

            ViewData["City"] = citylist;
            var allOrders = om.GetOrders();

            ViewData["AllOrders"] = allOrders;
            var allStaff = dsM.GetDelivery_staffs();

            ViewData["AllStaffs"] = allStaff;
            var allDishes = dishManager.GetAllDishes();

            ViewData["AllDishes"] = allDishes;
            var allOrderDishes = odm.GetAllOrders_dishes();

            ViewData["AllOrderDishes"] = allOrderDishes;
            var allRestaurants = restaurantManager.GetRestaurants();

            ViewData["AllRestaurants"] = allRestaurants;

            ViewBag.nameDL = HttpContext.Session.GetString("nameDL");
            var od = om.GetOrders_ds(id); //Get all orders according to the deliverer's id

            List <Order> odtrie = new List <Order>();

            //Creation of a list which will only contain the non delivery order(s)
            foreach (Order o in od)
            {
                if (o.status.Equals("non delivery"))
                {
                    odtrie.Add(o);
                }
            }

            return(View(odtrie)); //Display the non delivery order(s)
        }
        //List of all restaurants
        public ActionResult Index()
        {
            ICityDB      cityDB      = new CityDB(Configuration);
            ICityManager cityManager = new CityManager(cityDB);

            //creation of a ViewData for the display
            var restaurant = RestaurantManager.GetRestaurants();

            ViewData["Cities"] = cityManager.GetCities();
            return(View(restaurant)); //return the list of all restaurants
        }
Beispiel #3
0
        public ActionResult Create(DTO.Customer c)
        {
            ICityDB      cityDB      = new CityDB(Configuration);
            ICityManager cityManager = new CityManager(cityDB);

            //Creation of a list of cites so that the user can choose a city from a list during his account creation
            var citieslist = cityManager.GetCities();


            ViewBag.City = citieslist;
            CustomerManager.AddCustomer(c);
            return(RedirectToAction(nameof(Index))); //Return to the connection page
        }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Country combocountry = new Country();

            combocountry = (Country)comboBox1.SelectedItem;
            if (combocountry.NameCountry == "")
            {
                label2.Visible    = false;
                comboBox2.Visible = false;
                return;
            }
            label2.Visible          = true;
            comboBox2.Visible       = true;
            cityDB                  = new CityDB(countryDB, (Country)comboBox1.SelectedItem);
            comboBox2.DataSource    = null;
            comboBox2.DataSource    = cityDB.TransformationCombobox((Country)comboBox1.SelectedItem);
            comboBox2.DisplayMember = "NameCity";
        }
        public ActionResult Index()
        {
            List <CityDB> allCityDB = CityDB.GetAll();

            return(View(allCityDB));
        }
        public void WriteCity(City city)
        {
            CityDB dataaccess = new CityDB();

            dataaccess.CreateCity(city);
        }
        public ICollection <City> GetCities()
        {
            CityDB dataaccess = new CityDB();

            return(dataaccess.GetAllCities());
        }