예제 #1
0
        //Vue complexe utilisant le modèle OrderDetailsViewModel
        //Permet d'afficher le nom du restaurant de la commande, le numéro de la commande, les plats choisis (bug, 1 seul plat est affiché),
        //la quantité par plats, le prix unitaire d'un plat, l'heure de livraison...
        public ActionResult OrderDetails()
        {
            List <OrderDetailsViewModel> listeOrderDetails = new List <OrderDetailsViewModel>();
            OrderDetailsViewModel        orderDetails      = new OrderDetailsViewModel();

            int idCustomer     = HttpContext.Session.GetInt32("IdCustomer").GetValueOrDefault();
            int idOrder        = HttpContext.Session.GetInt32("IdOrder").GetValueOrDefault();
            int idRestaurant   = HttpContext.Session.GetInt32("IdRestaurant").GetValueOrDefault();
            int idDeliveryTime = HttpContext.Session.GetInt32("Id_Delivery_time").GetValueOrDefault();

            OrderManager.UpdateOrderDeliveryTime(idOrder, idDeliveryTime);

            List <DTO.Order_Dish> listeOrder_Dishes = Order_DishManager.GetAllOrder_Dish(idOrder);

            DTO.Customer   customer   = CustomerManager.GetCustomer(idCustomer);
            DTO.Order      order      = OrderManager.GetOrder(idOrder);
            DTO.Restaurant restaurant = RestaurantManager.GetRestaurant(idRestaurant);


            orderDetails.Customers      = customer;
            orderDetails.Orders         = order;
            orderDetails.Restaurants    = restaurant;
            orderDetails.Cities         = CityManager.GetCity(customer.FK_idCity);
            orderDetails.Delivery_Times = Delivery_TimeManager.GetDelivery_Time(idDeliveryTime);

            foreach (DTO.Order_Dish od in listeOrder_Dishes)
            {
                orderDetails.Order_Dishes = od;
                orderDetails.Dishes       = DishManager.GetDish(od.FK_idDish);
            }

            listeOrderDetails.Add(orderDetails);
            return(View(listeOrderDetails));
        }
예제 #2
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
        }
        public ActionResult Create(DTO.Customer c)
        {
            CustomersManager.AddCustomer(c);

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