コード例 #1
0
        public ActionResult Index()
        {
            string userId = User.Identity.GetUserId();
            ICollection <Reservation> reservations;

            if (User.IsInRole("Manager"))
            {
                Restaurant restaurant = restDb.GetRestaurantFull(User.Identity.GetUserId());
                if (restaurant == null)
                {
                    return(RedirectToAction("Create", "Restaurants"));
                }
                ViewBag.Restaurants = restDb.GetRestaurants();

                reservations = db.GetRestaurantReservations(userId);
                return(View(reservations));
            }
            reservations        = db.GetCustomerReservationsFull(userId);
            ViewBag.Restaurants = restDb.GetRestaurants();
            return(View(reservations));
        }