示例#1
0
        // GET: Restaurants
        public IActionResult Index()
        {
            var userID     = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var restaurant = _restaurantManager.GetRestaurantByUserID(userID);

            if (restaurant == null)
            {
                return(RedirectToAction(nameof(Initialize)));
            }

            return(View(restaurant));
        }
 public IActionResult Create(ReceiptDetailsViewModel viewModel)
 {
     if (ModelState.IsValid)
     {
         var userID     = HttpContext.User.FindFirstValue(ClaimTypes.NameIdentifier);
         var restaurant = _restaurantManager.GetRestaurantByUserID(userID);
         var tax        = restaurant.Tax;
         var orderID    = viewModel.OrderID;
         var order      = _orderManager.GetOrderByID(orderID);
         var receipt    = _receiptManager.CreateReceipt(order, userID, tax);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(viewModel));
 }