Ejemplo n.º 1
0
        //Display available delivery time for a staff
        //But the user must be logged in
        public IActionResult SelectTime()
        {
            ViewBag.username = HttpContext.Session.GetString("username");
            ViewBag.userType = HttpContext.Session.GetInt32("userType");
            if (HttpContext.Session.GetInt32("id") == null)
            {
                return(RedirectToAction("loginError", "Error", new { message = "Unfortunately it seems like you are not logged in. Please log in." }));
            }
            int         restaurant = 0;
            List <Item> cart       = SessionHelper.GetObjectFromJson <List <Item> >(HttpContext.Session, "cart");

            //We reuse the id of the restaurant to find our its location and suggest the correct staff's availability
            foreach (Item dish in cart)
            {
                restaurant = dish.Dishe.idRestaurant;
            }
            AvailibilityManager aManager = new AvailibilityManager(Configuration);

            return(View(aManager.GetAvailabilitiesByRestaurant(restaurant)));
        }