Esempio n. 1
0
 public double GetTotalExpenses(Visit visit)
 {
     return(visitBl.TotalExpences(visit));
 }
Esempio n. 2
0
        public IActionResult OnPostBuy(double?ServicePrice, double?ProductPrice)
        {
            if (ModelState.IsValid)
            {
                var customer = customerData.GetCustomerById(Visit.CustomoerId.Value);
                Visit.Customer = customer;

                if (ProductPrice.HasValue && ProductPrice.Value > 0)
                {
                    Visit.ShopItems.Add(visitBl.CreateProduct(ProductPrice.Value));
                }
                if (ServicePrice.HasValue && ServicePrice.Value > 0)
                {
                    Visit.ShopItems.Add(visitBl.CreateService(ServicePrice.Value));
                }
            }
            Message = Visit.CustomoerId == null ? "No customer selected." : $"Total expences: {visitBl.TotalExpences(Visit)}";
            var customers = customerData.GetCustomers().ToList().Select(p => new { Id = p.Id, Display = $"{p.FirstName} {p.LastName}" });

            Customers = new SelectList(customers, "Id", "Display");
            return(Page());
        }