public void OnPostBuy(double?priceProduct, double?priceService) { if (ModelState.IsValid) { var customer = customerData.GetCustomer(Visit.CustomerId.Value); Visit.Customer = customer; if (priceProduct > 0 && priceProduct.HasValue) { ShopItem shopItem = new ShopItem { ItemType = ItemType.Product, Price = priceProduct.Value }; Visit.ShopItems.Add(shopItem); } if (priceService > 0 && priceService.HasValue) { ShopItem shopItem = new ShopItem { ItemType = ItemType.Service, Price = priceService.Value }; Visit.ShopItems.Add(shopItem); } } Message = Visit.CustomerId == null ? "No customer selected!" : $"Total pay: {visitTP.TotalPrice(Visit)}"; Customers = customerData.GetCustomers().Select(x => new SelectListItem { Value = x.Id.ToString(), Text = x.Name }).ToList(); }
public double GetPrice(BeautyShop.Core.Visit visit) { return(visitTP.TotalPrice(visit)); }