public async Task <IViewComponentResult> InvokeAsync(int id)
        {
            bool checkin;
            var  reservations = RestaurantsManager.GetCheckinTodayReservationsByRestaurantID(id);
            List <ResCustomerModelView> viewReservations = new List <ResCustomerModelView>();

            foreach (ReservationEntry resAux in reservations)
            {
                var customer = CustomersManager.GetCustomerByCustomerId(resAux.CustomerId);
                if (resAux.CheckinDateTime == null)
                {
                    checkin = false;
                }
                else
                {
                    checkin = true;
                }
                var viewReservation = new ResCustomerModelView
                {
                    RestaurantID       = (int)resAux.RestaurantId,
                    CustomerId         = (int)resAux.CustomerId,
                    CustomerName       = $"{customer.User.FirstName} {customer.User.LastName}",
                    Restaurant         = resAux.Restaurant.RestaurantName,
                    ReservationEntryId = resAux.ReservationId,
                    PartySize          = resAux.PartySize,
                    ReservationStatus  = resAux.ReservationStatus,
                    EntryOrigin        = resAux.EntryOrigin,
                    ReservationDate    = resAux.ReservationDateTime,
                    Checkin            = checkin
                };
                viewReservations.Add(viewReservation);
            }
            return(View(viewReservations));
        }
Esempio n. 2
0
        public IActionResult ReservationManage()
        {
            LogRestaurant();
            ClaimsPrincipal             cp               = this.User;
            var                         claims           = cp.Claims.ToList();
            var                         restId           = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var                         reservations     = RestaurantsManager.GetManageReservations(restId);
            List <ResCustomerModelView> viewReservations = new List <ResCustomerModelView>();

            foreach (ReservationEntry resAux in reservations)
            {
                if (resAux.ReservationStatus != "on Hold")
                {
                    var customer        = CustomersManager.GetCustomerByCustomerId(resAux.CustomerId);
                    var viewReservation = new ResCustomerModelView
                    {
                        RestaurantID       = (int)resAux.RestaurantId,
                        CustomerId         = (int)resAux.CustomerId,
                        CustomerName       = $"{customer.User.FirstName} {customer.User.LastName}",
                        Restaurant         = resAux.Restaurant.RestaurantName,
                        ReservationEntryId = resAux.ReservationId,
                        PartySize          = resAux.PartySize,
                        ReservationStatus  = resAux.ReservationStatus,
                        EntryOrigin        = resAux.EntryOrigin,
                        ReservationDate    = resAux.ReservationDateTime
                    };
                    viewReservations.Add(viewReservation);
                }
            }
            ViewBag.RestaurantID = restId;
            return(View(viewReservations));
        }
Esempio n. 3
0
        public IActionResult HostManage()
        {
            LogRestaurant();
            ClaimsPrincipal cp       = this.User;
            var             claims   = cp.Claims.ToList();
            var             restId   = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "RestaurantID").Value);
            var             waitlist = RestaurantsManager.GetWaitlistByRestaurantID(restId);
            List <WaitCustomerModelView> viewWaitlist = new List <WaitCustomerModelView>();

            foreach (WaitlistEntry waitAux in waitlist)
            {
                var customer          = CustomersManager.GetCustomerByCustomerId(waitAux.CustomerId);
                var viewWaitlistEntry = new WaitCustomerModelView
                {
                    RestaurantID     = (int)waitAux.RestaurantId,
                    CustomerId       = (int)waitAux.CustomerId,
                    CustomerName     = $"{customer.User.FirstName} {customer.User.LastName}",
                    Restaurant       = waitAux.Restaurant.RestaurantName,
                    WaitlistEntryId  = waitAux.WaitlistEntryId,
                    PartySizew       = waitAux.PartySize,
                    WaitlistStatus   = waitAux.WaitlistStatus,
                    EntryOriginw     = waitAux.EntryOrigin,
                    WaitlistPosition = Convert.ToString(RestaurantsManager.GetWaitlistPosition(restId, waitAux.WaitlistEntryId))
                };
                viewWaitlist.Add(viewWaitlistEntry);
            }
            var orderViewWaitlist = viewWaitlist.OrderBy(w => w.WaitlistPosition);

            ViewBag.RestaurantID = restId;
            return(View(orderViewWaitlist));
        }
        public async Task <IViewComponentResult> InvokeAsync(int id)
        {
            var reservations = RestaurantsManager.GetManageReservations(id);

            List <ResCustomerModelView> viewReservations = new List <ResCustomerModelView>();

            foreach (ReservationEntry resAux in reservations)
            {
                if (resAux.ReservationStatus == "on Hold")
                {
                    var customer        = CustomersManager.GetCustomerByCustomerId(resAux.CustomerId);
                    var viewReservation = new ResCustomerModelView
                    {
                        RestaurantID       = (int)resAux.RestaurantId,
                        CustomerId         = (int)resAux.CustomerId,
                        CustomerName       = $"{customer.User.FirstName} {customer.User.LastName}",
                        Restaurant         = resAux.Restaurant.RestaurantName,
                        ReservationEntryId = resAux.ReservationId,
                        PartySize          = resAux.PartySize,
                        ReservationStatus  = resAux.ReservationStatus,
                        EntryOrigin        = resAux.EntryOrigin,
                        ReservationDate    = resAux.ReservationDateTime
                    };
                    viewReservations.Add(viewReservation);
                }
            }
            return(View(viewReservations));
        }