Пример #1
0
        //Customer's Reservations
        public IActionResult ReservationsShow()
        {
            LogRestaurant();
            if (TempData["ErrorMessage"] != null)
            {
                ViewBag.ErrorMessage = TempData["ErrorMessage"];
            }
            if (TempData["Message"] != null)
            {
                ViewBag.Message = TempData["Message"];
            }
            ClaimsPrincipal cp               = this.User;
            var             claims           = cp.Claims.ToList();
            var             custId           = Convert.ToInt32(claims.SingleOrDefault(p => p.Type == "CustomerID").Value);
            var             reservations     = CustomersManager.GetReservations(custId);
            var             viewReservations = reservations.Select(r => new ResCustomerModelView
            {
                RestaurantID       = (int)r.RestaurantId,
                CustomerId         = (int)r.CustomerId,
                Restaurant         = r.Restaurant.RestaurantName,
                ReservationEntryId = r.ReservationId,
                PartySize          = r.PartySize,
                ReservationStatus  = r.ReservationStatus,
                EntryOrigin        = r.EntryOrigin,
                ReservationDate    = r.ReservationDateTime,
                Message            = r.CustomerMessage
            }).ToList();

            return(View(viewReservations));
        }