public IActionResult ProcessShopSelection(Inquiry inquiry, long cartID, long cartItemID, int resourceTypeID, int rateCompositionID, int numberOfUnits, int numberOfGuests, decimal pricePerUnit) { inquiry.DateOfInquiry = System.DateTime.Now; string userID = "system"; Cart cCart = (shopRepository.GetCart(cartID) ?? shopRepository.CreateCart(inquiry, userID)); CartItem cCartItem = shopRepository.GetCartItem(cartItemID); if (cCartItem == null) { cCart = shopRepository.AddCartItemToCart(cCart, resourceTypeID, rateCompositionID, inquiry.DateOfArrival, inquiry.DateOfDeparture, numberOfUnits, pricePerUnit); } else { cCart = shopRepository.UpdateCartItemInCart(cCartItem, rateCompositionID, numberOfUnits, numberOfGuests, pricePerUnit); } ShopDisplay shop = new ShopDisplay() { Cart = cCart, OfferedResourceTypes = availabilityRepsository.GetOfferedResourceTypes(inquiry), Inquiry = inquiry, }; return(View(nameof(Index), shop)); }
private void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; shop = GameObject.FindGameObjectWithTag("ShopDisplay").GetComponent <ShopDisplay>(); Cam = Camera.main.transform; NPC_Name.text = Name; }
public IActionResult CheckAvailability(string companyID, int channelID, DateTime dateOfArrival, DateTime dateOfDeparture, int numberOfGuests, int numberOfUnits) { Inquiry inquiry = shopRepository.CreateInquiry(companyID, channelID, dateOfArrival, dateOfDeparture, numberOfUnits, numberOfGuests); ShopDisplay shopDisplay = new ShopDisplay() { Inquiry = inquiry, OfferedResourceTypes = availabilityRepsository.GetOfferedResourceTypes(inquiry) }; return(View("Index", shopDisplay)); }
public IActionResult RemoveItemFromCart(long cartItemID, Inquiry inquiry) { CartItem cartItem = shopRepository.GetCartItem(cartItemID); Cart cart = shopRepository.GetCart(cartItem.CartID); ShopDisplay shop = new ShopDisplay() { Cart = cart, OfferedResourceTypes = availabilityRepsository.GetOfferedResourceTypes(inquiry), Inquiry = inquiry }; return(View(nameof(Index), shop)); }
public void Open() { ShopInstance = Instantiate(shopDisplayPrefab); ShopInstance.Prime(Items); }
public static void Buy(Inventory playerInventory, PlayerBalance playerBalance, Item itemToBuy, ShopDisplay shopDisplay) { // Check if the player can afford the item. var itemValue = itemToBuy.GetValue(); var canAfford = playerBalance.GetBalance() >= itemValue; // Return if the item is too expensive. if (!canAfford) { return; } // Add the item to the inventory. playerInventory.AddItem(itemToBuy); // Remove the price of the item from the playerBalance.ChangeBalance(-itemValue); // Regenerate the ui. shopDisplay.Regenerate(); }